From 39811547905ea51c54242378fc60f61e4e5a0467 Mon Sep 17 00:00:00 2001 From: Hovsep Mkrtchyan Date: Thu, 29 Sep 2016 12:38:26 -0700 Subject: [PATCH 1/2] Fixed Feature client --- .../azure/management/resources/Features.java | 23 ++------- .../collection/SupportsListing.java | 1 - .../implementation/FeaturesImpl.java | 4 +- .../FeaturesInResourceProviderImpl.java | 47 ------------------- 4 files changed, 6 insertions(+), 69 deletions(-) delete mode 100644 azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/FeaturesInResourceProviderImpl.java diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Features.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Features.java index c473d87bcc85a..3b41a7df9c1b6 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Features.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Features.java @@ -18,26 +18,11 @@ public interface Features extends SupportsListing { /** - * Filter the features by a specific resource provider. + * Registers a feature in a resource provider. * * @param resourceProviderName the name of the resource provider - * @return an instance for accessing features in a resource provider + * @param featureName the name of the feature + * @return the immutable client-side feature object created */ - InResourceProvider resourceProvider(String resourceProviderName); - - /** - * Entry point to features management API in a specific resource provider. - */ - @LangDefinition(ContainerName = "~/Feature") - interface InResourceProvider extends - SupportsListing, - SupportsGettingByName { - /** - * Registers a feature in a resource provider. - * - * @param featureName the name of the feature - * @return the immutable client-side feature object created - */ - Feature register(String featureName); - } + Feature register(String resourceProviderName, String featureName); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/collection/SupportsListing.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/collection/SupportsListing.java index b8ac4f06b2285..e096573a5c1d8 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/collection/SupportsListing.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/collection/SupportsListing.java @@ -25,6 +25,5 @@ public interface SupportsListing { * * @return list of resources */ - @Method PagedList list(); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/FeaturesImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/FeaturesImpl.java index fd893f990e112..c73b050167156 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/FeaturesImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/FeaturesImpl.java @@ -29,8 +29,8 @@ public PagedList list() { } @Override - public InResourceProvider resourceProvider(String resourceProviderName) { - return null; + public Feature register(String resourceProviderName, String featureName) { + return wrapModel(client.register(resourceProviderName, featureName)); } @Override diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/FeaturesInResourceProviderImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/FeaturesInResourceProviderImpl.java deleted file mode 100644 index aeff935c2601e..0000000000000 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/FeaturesInResourceProviderImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -package com.microsoft.azure.management.resources.implementation; - -import com.microsoft.azure.PagedList; -import com.microsoft.azure.management.resources.Feature; -import com.microsoft.azure.management.resources.Features; -import com.microsoft.azure.management.resources.fluentcore.utils.PagedListConverter; - -/** - * The implementation of {@link Features.InResourceProvider}. - */ -final class FeaturesInResourceProviderImpl - implements Features.InResourceProvider { - private final FeaturesInner client; - private String resourceProviderNamespace; - - FeaturesInResourceProviderImpl(FeaturesInner client, String resourceProviderNamespace) { - this.client = client; - this.resourceProviderNamespace = resourceProviderNamespace; - } - - @Override - public PagedList list() { - PagedListConverter converter = new PagedListConverter() { - @Override - public Feature typeConvert(FeatureResultInner tenantInner) { - return new FeatureImpl(tenantInner); - } - }; - return converter.convert(client.list(resourceProviderNamespace)); - } - - @Override - public Feature register(String featureName) { - return new FeatureImpl(client.register(resourceProviderNamespace, featureName)); - } - - @Override - public Feature getByName(String name) { - return new FeatureImpl(client.get(resourceProviderNamespace, name)); - } -} From ca40ae2549bd11f90358c45ae37ed51e16f0c601 Mon Sep 17 00:00:00 2001 From: Hovsep Mkrtchyan Date: Thu, 29 Sep 2016 13:11:09 -0700 Subject: [PATCH 2/2] fixed style check issues. --- .../java/com/microsoft/azure/management/resources/Features.java | 2 -- .../resources/fluentcore/collection/SupportsListing.java | 1 - 2 files changed, 3 deletions(-) diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Features.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Features.java index 3b41a7df9c1b6..02c62871d2265 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Features.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Features.java @@ -7,8 +7,6 @@ package com.microsoft.azure.management.resources; import com.microsoft.azure.management.apigeneration.Fluent; -import com.microsoft.azure.management.apigeneration.LangDefinition; -import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; /** diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/collection/SupportsListing.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/collection/SupportsListing.java index e096573a5c1d8..52edb0d3dc0dc 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/collection/SupportsListing.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/collection/SupportsListing.java @@ -9,7 +9,6 @@ import com.microsoft.azure.PagedList; import com.microsoft.azure.management.apigeneration.LangDefinition; import com.microsoft.azure.management.apigeneration.LangDefinition.MethodConversion; -import com.microsoft.azure.management.apigeneration.Method; /** * Provides access to listing Azure resources of a specific type in a subscription.