diff --git a/azure-mgmt-locks/src/main/java/com/microsoft/azure/management/locks/implementation/ManagementLocksInner.java b/azure-mgmt-locks/src/main/java/com/microsoft/azure/management/locks/implementation/ManagementLocksInner.java index f0ed474220e..7ebc8562430 100644 --- a/azure-mgmt-locks/src/main/java/com/microsoft/azure/management/locks/implementation/ManagementLocksInner.java +++ b/azure-mgmt-locks/src/main/java/com/microsoft/azure/management/locks/implementation/ManagementLocksInner.java @@ -320,8 +320,8 @@ public Observable> call(Response response) { private ServiceResponse deleteAtResourceGroupLevelDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -581,8 +581,8 @@ public Observable> call(Response response) { private ServiceResponse deleteByScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -909,8 +909,8 @@ public Observable> call(Response response) { private ServiceResponse deleteAtResourceLevelDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1115,8 +1115,8 @@ public Observable> call(Response createOrUpdateAtSubscriptionLevelDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(201, new TypeToken() { }.getType()) .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1198,8 +1198,8 @@ public Observable> call(Response response) { private ServiceResponse deleteAtSubscriptionLevelDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/HttpMessage.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/HttpMessage.java index 6af003a631f..101676c29ad 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/HttpMessage.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/HttpMessage.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * HTTP message. + * The HttpMessage model. */ public class HttpMessage { /** diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Plan.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Plan.java index a0132bc9a73..e04fa9db967 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Plan.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Plan.java @@ -38,12 +38,6 @@ public class Plan { @JsonProperty(value = "promotionCode") private String promotionCode; - /** - * The plan's version. - */ - @JsonProperty(value = "version") - private String version; - /** * Get the name value. * @@ -124,24 +118,4 @@ public Plan withPromotionCode(String promotionCode) { return this; } - /** - * Get the version value. - * - * @return the version value - */ - public String version() { - return this.version; - } - - /** - * Set the version value. - * - * @param version the version value to set - * @return the Plan object itself. - */ - public Plan withVersion(String version) { - this.version = version; - return this; - } - } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceManagementErrorWithDetails.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceManagementErrorWithDetails.java index 6bde7f126f6..19633f57a75 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceManagementErrorWithDetails.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceManagementErrorWithDetails.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The detailed error message of resource management. + * The ResourceManagementErrorWithDetails model. */ public class ResourceManagementErrorWithDetails { /** diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentExtendedInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentExtendedInner.java index ed87fc8907d..52727eb71ea 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentExtendedInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentExtendedInner.java @@ -18,7 +18,7 @@ public class DeploymentExtendedInner { /** * The ID of the deployment. */ - @JsonProperty(value = "id") + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /** @@ -42,17 +42,6 @@ public String id() { return this.id; } - /** - * Set the id value. - * - * @param id the id value to set - * @return the DeploymentExtendedInner object itself. - */ - public DeploymentExtendedInner withId(String id) { - this.id = id; - return this; - } - /** * Get the name value. * diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PageImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PageImpl.java index 9d9408604d5..aa7cd7094b0 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PageImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PageImpl.java @@ -22,7 +22,7 @@ public class PageImpl implements Page { /** * The link to the next page. */ - @JsonProperty("nextLink") + @JsonProperty("") private String nextPageLink; /** diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyAssignmentInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyAssignmentInner.java index 0042377dd86..c098301f404 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyAssignmentInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyAssignmentInner.java @@ -9,11 +9,8 @@ package com.microsoft.azure.management.resources.implementation; import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.azure.management.resources.PolicySku; import com.microsoft.rest.serializer.JsonFlatten; -import java.util.List; - /** * The policy assignment. */ @@ -37,54 +34,24 @@ public class PolicyAssignmentInner { @JsonProperty(value = "properties.scope") private String scope; - /** - * The policy's excluded scopes. - */ - @JsonProperty(value = "properties.notScopes") - private List notScopes; - - /** - * Required if a parameter is used in policy rule. - */ - @JsonProperty(value = "properties.parameters") - private Object parameters; - - /** - * This message will be part of response in case of policy violation. - */ - @JsonProperty(value = "properties.description") - private String description; - - /** - * The policy assignment metadata. - */ - @JsonProperty(value = "properties.metadata") - private Object metadata; - /** * The ID of the policy assignment. */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "id") private String id; /** * The type of the policy assignment. */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "type") private String type; /** * The name of the policy assignment. */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "name") private String name; - /** - * The policy sku. - */ - @JsonProperty(value = "sku") - private PolicySku sku; - /** * Get the displayName value. * @@ -146,103 +113,45 @@ public PolicyAssignmentInner withScope(String scope) { } /** - * Get the notScopes value. - * - * @return the notScopes value - */ - public List notScopes() { - return this.notScopes; - } - - /** - * Set the notScopes value. - * - * @param notScopes the notScopes value to set - * @return the PolicyAssignmentInner object itself. - */ - public PolicyAssignmentInner withNotScopes(List notScopes) { - this.notScopes = notScopes; - return this; - } - - /** - * Get the parameters value. - * - * @return the parameters value - */ - public Object parameters() { - return this.parameters; - } - - /** - * Set the parameters value. - * - * @param parameters the parameters value to set - * @return the PolicyAssignmentInner object itself. - */ - public PolicyAssignmentInner withParameters(Object parameters) { - this.parameters = parameters; - return this; - } - - /** - * Get the description value. + * Get the id value. * - * @return the description value + * @return the id value */ - public String description() { - return this.description; + public String id() { + return this.id; } /** - * Set the description value. + * Set the id value. * - * @param description the description value to set + * @param id the id value to set * @return the PolicyAssignmentInner object itself. */ - public PolicyAssignmentInner withDescription(String description) { - this.description = description; + public PolicyAssignmentInner withId(String id) { + this.id = id; return this; } /** - * Get the metadata value. + * Get the type value. * - * @return the metadata value + * @return the type value */ - public Object metadata() { - return this.metadata; + public String type() { + return this.type; } /** - * Set the metadata value. + * Set the type value. * - * @param metadata the metadata value to set + * @param type the type value to set * @return the PolicyAssignmentInner object itself. */ - public PolicyAssignmentInner withMetadata(Object metadata) { - this.metadata = metadata; + public PolicyAssignmentInner withType(String type) { + this.type = type; return this; } - /** - * Get the id value. - * - * @return the id value - */ - public String id() { - return this.id; - } - - /** - * Get the type value. - * - * @return the type value - */ - public String type() { - return this.type; - } - /** * Get the name value. * @@ -253,22 +162,13 @@ public String name() { } /** - * Get the sku value. - * - * @return the sku value - */ - public PolicySku sku() { - return this.sku; - } - - /** - * Set the sku value. + * Set the name value. * - * @param sku the sku value to set + * @param name the name value to set * @return the PolicyAssignmentInner object itself. */ - public PolicyAssignmentInner withSku(PolicySku sku) { - this.sku = sku; + public PolicyAssignmentInner withName(String name) { + this.name = name; return this; } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyAssignmentsInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyAssignmentsInner.java index 9e8c7a7e2f9..3e275c767ec 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyAssignmentsInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyAssignmentsInner.java @@ -13,8 +13,8 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; -import com.microsoft.azure.management.resources.ErrorResponseException; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -64,15 +64,15 @@ public PolicyAssignmentsInner(Retrofit retrofit, PolicyClientImpl client) { */ interface PolicyAssignmentsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyAssignments delete" }) - @HTTP(path = "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", method = "DELETE", hasBody = true) + @HTTP(path = "{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}", method = "DELETE", hasBody = true) Observable> delete(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyAssignments create" }) - @PUT("{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}") + @PUT("{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}") Observable> create(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Body PolicyAssignmentInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyAssignments get" }) - @GET("{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}") + @GET("{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}") Observable> get(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyAssignments listByResourceGroup" }) @@ -80,11 +80,11 @@ interface PolicyAssignmentsService { Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query(value = "$filter", encoded = true) String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyAssignments listForResource" }) - @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments") + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyassignments") Observable> listForResource(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyAssignments list" }) - @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments") + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyassignments") Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyAssignments deleteById" }) @@ -119,7 +119,7 @@ interface PolicyAssignmentsService { * @param scope The scope of the policy assignment. * @param policyAssignmentName The name of the policy assignment to delete. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorResponseException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PolicyAssignmentInner object if successful. */ @@ -172,8 +172,10 @@ public Observable> deleteWithServiceRespo if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; - return service.delete(scope, policyAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(scope, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -187,11 +189,10 @@ public Observable> call(Response deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -203,7 +204,7 @@ private ServiceResponse deleteDelegate(Response> createWithServiceRespo if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(parameters); - final String apiVersion = "2017-06-01-preview"; - return service.create(scope, policyAssignmentName, parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.create(scope, policyAssignmentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -281,10 +284,10 @@ public Observable> call(Response createDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(201, new TypeToken() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -294,7 +297,7 @@ private ServiceResponse createDelegate(Response> getWithServiceResponse if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; - return service.get(scope, policyAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(scope, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -362,10 +367,10 @@ public Observable> call(Response getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -374,7 +379,7 @@ private ServiceResponse getDelegate(Response>> listByResourceGr if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String filter = null; - return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -482,7 +489,7 @@ public Observable>> call(Response>> listByResourceGr if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; - return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -587,10 +596,10 @@ public Observable>> call(Response> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -603,7 +612,7 @@ private ServiceResponse> listByResourceGroupDele * @param resourceType The resource type. * @param resourceName The name of the resource with policy assignments. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorResponseException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<PolicyAssignmentInner> object if successful. */ @@ -717,9 +726,11 @@ public Observable>> listForResourceS if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String filter = null; - return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -743,7 +754,7 @@ public Observable>> call(Response>> listForResourceS if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; - return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -876,10 +889,10 @@ public Observable>> call(Response> listForResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> listForResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -887,7 +900,7 @@ private ServiceResponse> listForResourceDelegate * Gets all the policy assignments for a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorResponseException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<PolicyAssignmentInner> object if successful. */ @@ -966,9 +979,11 @@ public Observable>> listSinglePageAs if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String filter = null; - return service.list(this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -987,7 +1002,7 @@ public Observable>> call(Response>> listSinglePageAs if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; - return service.list(this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1085,10 +1102,10 @@ public Observable>> call(Response> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -1098,7 +1115,7 @@ private ServiceResponse> listDelegate(Response> deleteByIdWithServiceR if (policyAssignmentId == null) { throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; - return service.deleteById(policyAssignmentId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteById(policyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1163,10 +1182,10 @@ public Observable> call(Response deleteByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse deleteByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -1177,7 +1196,7 @@ private ServiceResponse deleteByIdDelegate(Response> createByIdWithServiceR if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(parameters); - final String apiVersion = "2017-06-01-preview"; - return service.createById(policyAssignmentId, parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.createById(policyAssignmentId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1249,10 +1270,10 @@ public Observable> call(Response createByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse createByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(201, new TypeToken() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -1262,7 +1283,7 @@ private ServiceResponse createByIdDelegate(Response> getByIdWithServiceResp if (policyAssignmentId == null) { throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); } - final String apiVersion = "2017-06-01-preview"; - return service.getById(policyAssignmentId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getById(policyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1327,10 +1350,10 @@ public Observable> call(Response getByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse getByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -1339,7 +1362,7 @@ private ServiceResponse getByIdDelegate(Response>> call(Response> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -1450,7 +1473,7 @@ private ServiceResponse> listByResourceGroupNext * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorResponseException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<PolicyAssignmentInner> object if successful. */ @@ -1549,10 +1572,10 @@ public Observable>> call(Response> listForResourceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> listForResourceNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } @@ -1561,7 +1584,7 @@ private ServiceResponse> listForResourceNextDele * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorResponseException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<PolicyAssignmentInner> object if successful. */ @@ -1660,10 +1683,10 @@ public Observable>> call(Response> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorResponseException.class) + .registerError(CloudException.class) .build(response); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyClientImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyClientImpl.java index 1bb10c6b512..ddcee842610 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyClientImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyClientImpl.java @@ -51,6 +51,18 @@ public PolicyClientImpl withSubscriptionId(String subscriptionId) { return this; } + /** The API version to use for the operation. */ + private String apiVersion; + + /** + * Gets The API version to use for the operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -133,19 +145,6 @@ public PolicyAssignmentsInner policyAssignments() { return this.policyAssignments; } - /** - * The PolicySetDefinitionsInner object to access its operations. - */ - private PolicySetDefinitionsInner policySetDefinitions; - - /** - * Gets the PolicySetDefinitionsInner object to access its operations. - * @return the PolicySetDefinitionsInner object. - */ - public PolicySetDefinitionsInner policySetDefinitions() { - return this.policySetDefinitions; - } - /** * The PolicyDefinitionsInner object to access its operations. */ @@ -190,11 +189,11 @@ public PolicyClientImpl(RestClient restClient) { } protected void initialize() { + this.apiVersion = "2016-04-01"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.policyAssignments = new PolicyAssignmentsInner(restClient().retrofit(), this); - this.policySetDefinitions = new PolicySetDefinitionsInner(restClient().retrofit(), this); this.policyDefinitions = new PolicyDefinitionsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } @@ -206,6 +205,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s)", super.userAgent(), "PolicyClient"); + return String.format("%s (%s, %s)", super.userAgent(), "PolicyClient", "2016-04-01"); } } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyDefinitionInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyDefinitionInner.java index e88673d141f..49ff3d1c59d 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyDefinitionInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyDefinitionInner.java @@ -9,7 +9,6 @@ package com.microsoft.azure.management.resources.implementation; import com.microsoft.azure.management.resources.PolicyType; -import com.microsoft.azure.management.resources.PolicyMode; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -26,13 +25,6 @@ public class PolicyDefinitionInner { @JsonProperty(value = "properties.policyType") private PolicyType policyType; - /** - * The policy definition mode. Possible values are NotSpecified, Indexed, - * and All. Possible values include: 'NotSpecified', 'Indexed', 'All'. - */ - @JsonProperty(value = "properties.mode") - private PolicyMode mode; - /** * The display name of the policy definition. */ @@ -51,18 +43,6 @@ public class PolicyDefinitionInner { @JsonProperty(value = "properties.policyRule") private Object policyRule; - /** - * The policy definition metadata. - */ - @JsonProperty(value = "properties.metadata") - private Object metadata; - - /** - * Required if a parameter is used in policy rule. - */ - @JsonProperty(value = "properties.parameters") - private Object parameters; - /** * The ID of the policy definition. */ @@ -70,9 +50,10 @@ public class PolicyDefinitionInner { private String id; /** - * The name of the policy definition. + * The name of the policy definition. If you do not specify a value for + * name, the value is inferred from the name value in the request URI. */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "name") private String name; /** @@ -95,26 +76,6 @@ public PolicyDefinitionInner withPolicyType(PolicyType policyType) { return this; } - /** - * Get the mode value. - * - * @return the mode value - */ - public PolicyMode mode() { - return this.mode; - } - - /** - * Set the mode value. - * - * @param mode the mode value to set - * @return the PolicyDefinitionInner object itself. - */ - public PolicyDefinitionInner withMode(PolicyMode mode) { - this.mode = mode; - return this; - } - /** * Get the displayName value. * @@ -175,46 +136,6 @@ public PolicyDefinitionInner withPolicyRule(Object policyRule) { return this; } - /** - * Get the metadata value. - * - * @return the metadata value - */ - public Object metadata() { - return this.metadata; - } - - /** - * Set the metadata value. - * - * @param metadata the metadata value to set - * @return the PolicyDefinitionInner object itself. - */ - public PolicyDefinitionInner withMetadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the parameters value. - * - * @return the parameters value - */ - public Object parameters() { - return this.parameters; - } - - /** - * Set the parameters value. - * - * @param parameters the parameters value to set - * @return the PolicyDefinitionInner object itself. - */ - public PolicyDefinitionInner withParameters(Object parameters) { - this.parameters = parameters; - return this; - } - /** * Get the id value. * @@ -233,4 +154,15 @@ public String name() { return this.name; } + /** + * Set the name value. + * + * @param name the name value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withName(String name) { + this.name = name; + return this; + } + } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyDefinitionsInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyDefinitionsInner.java index 4ae9cd0c2dd..ccf58475aea 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyDefinitionsInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/PolicyDefinitionsInner.java @@ -62,57 +62,25 @@ public PolicyDefinitionsInner(Retrofit retrofit, PolicyClientImpl client) { */ interface PolicyDefinitionsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions createOrUpdate" }) - @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}") Observable> createOrUpdate(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Body PolicyDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions delete" }) - @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) Observable> delete(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions get" }) - @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}") Observable> get(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions getBuiltIn" }) - @GET("providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") - Observable> getBuiltIn(@Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions createOrUpdateAtManagementGroup" }) - @PUT("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") - Observable> createOrUpdateAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Body PolicyDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions deleteAtManagementGroup" }) - @HTTP(path = "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) - Observable> deleteAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions getAtManagementGroup" }) - @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") - Observable> getAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions list" }) - @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions") - Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions listBuiltIn" }) - @GET("providers/Microsoft.Authorization/policyDefinitions") - Observable> listBuiltIn(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions listByManagementGroup" }) - @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions") - Observable> listByManagementGroup(@Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions listBuiltInNext" }) - @GET - Observable> listBuiltInNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.PolicyDefinitions listByManagementGroupNext" }) - @GET - Observable> listByManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - } /** @@ -177,9 +145,11 @@ public Observable> createOrUpdateWithServ if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(parameters); - final String apiVersion = "2016-12-01"; - return service.createOrUpdate(policyDefinitionName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdate(policyDefinitionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -254,8 +224,10 @@ public Observable> deleteWithServiceResponseAsync(String p if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2016-12-01"; - return service.delete(policyDefinitionName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(policyDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -332,8 +304,10 @@ public Observable> getWithServiceResponse if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2016-12-01"; - return service.get(policyDefinitionName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(policyDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -355,65 +329,99 @@ private ServiceResponse getDelegate(Response list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Gets the built in policy definition. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the built in policy definition to get. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getBuiltInAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getBuiltInWithServiceResponseAsync(policyDefinitionName), serviceCallback); + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Gets the built in policy definition. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the built in policy definition to get. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyDefinitionInner object + * @return the observable to the PagedList<PolicyDefinitionInner> object */ - public Observable getBuiltInAsync(String policyDefinitionName) { - return getBuiltInWithServiceResponseAsync(policyDefinitionName).map(new Func1, PolicyDefinitionInner>() { - @Override - public PolicyDefinitionInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Gets the built in policy definition. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the built in policy definition to get. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyDefinitionInner object + * @return the observable to the PagedList<PolicyDefinitionInner> object */ - public Observable> getBuiltInWithServiceResponseAsync(String policyDefinitionName) { - if (policyDefinitionName == null) { - throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the policy definitions for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2016-12-01"; - return service.getBuiltIn(policyDefinitionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = getBuiltInDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -421,88 +429,104 @@ public Observable> call(Response getBuiltInDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - /** - * Creates or updates a policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to create. - * @param managementGroupId The ID of the management group. - * @param parameters The policy definition properties. + * @param filter The filter to apply on the operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyDefinitionInner object if successful. + * @return the PagedList<PolicyDefinitionInner> object if successful. */ - public PolicyDefinitionInner createOrUpdateAtManagementGroup(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { - return createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters).toBlocking().single().body(); + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Creates or updates a policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to create. - * @param managementGroupId The ID of the management group. - * @param parameters The policy definition properties. + * @param filter The filter to apply on the operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters), serviceCallback); + public ServiceFuture> listAsync(final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Creates or updates a policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to create. - * @param managementGroupId The ID of the management group. - * @param parameters The policy definition properties. + * @param filter The filter to apply on the operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyDefinitionInner object + * @return the observable to the PagedList<PolicyDefinitionInner> object */ - public Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { - return createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters).map(new Func1, PolicyDefinitionInner>() { - @Override - public PolicyDefinitionInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Creates or updates a policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to create. - * @param managementGroupId The ID of the management group. - * @param parameters The policy definition properties. + * @param filter The filter to apply on the operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyDefinitionInner object + * @return the observable to the PagedList<PolicyDefinitionInner> object */ - public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { - if (policyDefinitionName == null) { - throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); - } - if (managementGroupId == null) { - throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the policy definitions for a subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Validator.validate(parameters); - final String apiVersion = "2016-12-01"; - return service.createOrUpdateAtManagementGroup(policyDefinitionName, managementGroupId, parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -510,576 +534,97 @@ public Observable> call(Response createOrUpdateAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(201, new TypeToken() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Deletes a policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to delete. - * @param managementGroupId The ID of the management group. + * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. */ - public void deleteAtManagementGroup(String policyDefinitionName, String managementGroupId) { - deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Deletes a policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to delete. - * @param managementGroupId The ID of the management group. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId), serviceCallback); + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Deletes a policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to delete. - * @param managementGroupId The ID of the management group. + * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the PagedList<PolicyDefinitionInner> object */ - public Observable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { - return deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Deletes a policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to delete. - * @param managementGroupId The ID of the management group. + * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the PagedList<PolicyDefinitionInner> object */ - public Observable> deleteAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId) { - if (policyDefinitionName == null) { - throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); - } - if (managementGroupId == null) { - throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); - } - final String apiVersion = "2016-12-01"; - return service.deleteAtManagementGroup(policyDefinitionName, managementGroupId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } - private ServiceResponse deleteAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - /** - * Gets the policy definition at management group level. + * Gets all the policy definitions for a subscription. * - * @param policyDefinitionName The name of the policy definition to get. - * @param managementGroupId The ID of the management group. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyDefinitionInner object if successful. - */ - public PolicyDefinitionInner getAtManagementGroup(String policyDefinitionName, String managementGroupId) { - return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); - } - - /** - * Gets the policy definition at management group level. - * - * @param policyDefinitionName The name of the policy definition to get. - * @param managementGroupId The ID of the management group. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId), serviceCallback); - } - - /** - * Gets the policy definition at management group level. - * - * @param policyDefinitionName The name of the policy definition to get. - * @param managementGroupId The ID of the management group. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyDefinitionInner object - */ - public Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { - return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1, PolicyDefinitionInner>() { - @Override - public PolicyDefinitionInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Gets the policy definition at management group level. - * - * @param policyDefinitionName The name of the policy definition to get. - * @param managementGroupId The ID of the management group. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyDefinitionInner object - */ - public Observable> getAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId) { - if (policyDefinitionName == null) { - throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); - } - if (managementGroupId == null) { - throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); - } - final String apiVersion = "2016-12-01"; - return service.getAtManagementGroup(policyDefinitionName, managementGroupId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = getAtManagementGroupDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse getAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Gets all the policy definitions for a subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<PolicyDefinitionInner> object if successful. - */ - public PagedList list() { - ServiceResponse> response = listSinglePageAsync().toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Gets all the policy definitions for a subscription. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listSinglePageAsync(), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Gets all the policy definitions for a subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable> listAsync() { - return listWithServiceResponseAsync() - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Gets all the policy definitions for a subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable>> listWithServiceResponseAsync() { - return listSinglePageAsync() - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Gets all the policy definitions for a subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listSinglePageAsync() { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - final String apiVersion = "2016-12-01"; - return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Gets all the built in policy definitions. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<PolicyDefinitionInner> object if successful. - */ - public PagedList listBuiltIn() { - ServiceResponse> response = listBuiltInSinglePageAsync().toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Gets all the built in policy definitions. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listBuiltInAsync(final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listBuiltInSinglePageAsync(), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listBuiltInNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Gets all the built in policy definitions. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable> listBuiltInAsync() { - return listBuiltInWithServiceResponseAsync() - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Gets all the built in policy definitions. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable>> listBuiltInWithServiceResponseAsync() { - return listBuiltInSinglePageAsync() - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Gets all the built in policy definitions. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listBuiltInSinglePageAsync() { - final String apiVersion = "2016-12-01"; - return service.listBuiltIn(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listBuiltInDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listBuiltInDelegate(Response response) throws CloudException, IOException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - * @param managementGroupId The ID of the management group. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<PolicyDefinitionInner> object if successful. - */ - public PagedList listByManagementGroup(final String managementGroupId) { - ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - * @param managementGroupId The ID of the management group. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listByManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listByManagementGroupSinglePageAsync(managementGroupId), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listByManagementGroupNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - * @param managementGroupId The ID of the management group. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable> listByManagementGroupAsync(final String managementGroupId) { - return listByManagementGroupWithServiceResponseAsync(managementGroupId) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - * @param managementGroupId The ID of the management group. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId) { - return listByManagementGroupSinglePageAsync(managementGroupId) - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - ServiceResponse> * @param managementGroupId The ID of the management group. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId) { - if (managementGroupId == null) { - throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); - } - final String apiVersion = "2016-12-01"; - return service.listByManagementGroup(managementGroupId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listByManagementGroupDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listByManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Gets all the policy definitions for a subscription. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<PolicyDefinitionInner> object if successful. - */ - public PagedList listNext(final String nextPageLink) { - ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Gets all the policy definitions for a subscription. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listNextSinglePageAsync(nextPageLink), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Gets all the policy definitions for a subscription. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable> listNextAsync(final String nextPageLink) { - return listNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Gets all the policy definitions for a subscription. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { - return listNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Gets all the policy definitions for a subscription. - * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { @@ -1107,226 +652,4 @@ private ServiceResponse> listNextDelegate(Respon .build(response); } - /** - * Gets all the built in policy definitions. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<PolicyDefinitionInner> object if successful. - */ - public PagedList listBuiltInNext(final String nextPageLink) { - ServiceResponse> response = listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Gets all the built in policy definitions. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listBuiltInNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listBuiltInNextSinglePageAsync(nextPageLink), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listBuiltInNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Gets all the built in policy definitions. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable> listBuiltInNextAsync(final String nextPageLink) { - return listBuiltInNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Gets all the built in policy definitions. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable>> listBuiltInNextWithServiceResponseAsync(final String nextPageLink) { - return listBuiltInNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Gets all the built in policy definitions. - * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listBuiltInNextSinglePageAsync(final String nextPageLink) { - if (nextPageLink == null) { - throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); - } - String nextUrl = String.format("%s", nextPageLink); - return service.listBuiltInNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listBuiltInNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listBuiltInNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<PolicyDefinitionInner> object if successful. - */ - public PagedList listByManagementGroupNext(final String nextPageLink) { - ServiceResponse> response = listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listByManagementGroupNextSinglePageAsync(nextPageLink), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listByManagementGroupNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable> listByManagementGroupNextAsync(final String nextPageLink) { - return listByManagementGroupNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<PolicyDefinitionInner> object - */ - public Observable>> listByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { - return listByManagementGroupNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Gets all the policy definitions for a subscription at management group level. - * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listByManagementGroupNextSinglePageAsync(final String nextPageLink) { - if (nextPageLink == null) { - throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); - } - String nextUrl = String.format("%s", nextPageLink); - return service.listByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listByManagementGroupNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listByManagementGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupExportResultInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupExportResultInner.java index e57ed546b93..9a0c5ae8c4c 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupExportResultInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupExportResultInner.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Resource group export result. + * The ResourceGroupExportResultInner model. */ public class ResourceGroupExportResultInner { /** diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupInner.java index 159d46ede1c..9e8bceac184 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupInner.java @@ -36,7 +36,7 @@ public class ResourceGroupInner { /** * The location of the resource group. It cannot be changed after the - * resource group has been created. It must be one of the supported Azure + * resource group has been created. It muct be one of the supported Azure * locations. */ @JsonProperty(value = "location", required = true) diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupsInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupsInner.java index 33286a2a37e..ff4b8635e66 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupsInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupsInner.java @@ -64,6 +64,10 @@ public ResourceGroupsInner(Retrofit retrofit, ResourceManagementClientImpl clien * used by Retrofit to perform actually REST calls. */ interface ResourceGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.ResourceGroups listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$expand") String expand, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.ResourceGroups checkExistence" }) @HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") Observable> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -84,9 +88,9 @@ interface ResourceGroupsService { @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.ResourceGroups update" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.ResourceGroups patch" }) @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourceGroupPatchableInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> patch(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourceGroupInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.ResourceGroups exportTemplate" }) @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate") @@ -96,12 +100,257 @@ interface ResourceGroupsService { @GET("subscriptions/{subscriptionId}/resourcegroups") Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.ResourceGroups listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.ResourceGroups listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GenericResourceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final String expand = null; + final Integer top = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation. + * @param expand The $expand query parameter + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GenericResourceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter, final String expand, final Integer top) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation. + * @param expand The $expand query parameter + * @param top The number of results to return. If null is passed, returns all resources. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation. + * @param expand The $expand query parameter + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, expand, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation. + * @param expand The $expand query parameter + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + ServiceResponse> * @param resourceGroupName The resource group with the resources to get. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param expand The $expand query parameter + ServiceResponse> * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Checks whether a resource group exists. * @@ -183,7 +432,7 @@ private ServiceResponse checkExistenceDelegate(Response response) } /** - * Creates or updates a resource group. + * Creates a resource group. * * @param resourceGroupName The name of the resource group to create or update. * @param parameters Parameters supplied to the create or update a resource group. @@ -197,7 +446,7 @@ public ResourceGroupInner createOrUpdate(String resourceGroupName, ResourceGroup } /** - * Creates or updates a resource group. + * Creates a resource group. * * @param resourceGroupName The name of the resource group to create or update. * @param parameters Parameters supplied to the create or update a resource group. @@ -210,7 +459,7 @@ public ServiceFuture createOrUpdateAsync(String resourceGrou } /** - * Creates or updates a resource group. + * Creates a resource group. * * @param resourceGroupName The name of the resource group to create or update. * @param parameters Parameters supplied to the create or update a resource group. @@ -227,7 +476,7 @@ public ResourceGroupInner call(ServiceResponse response) { } /** - * Creates or updates a resource group. + * Creates a resource group. * * @param resourceGroupName The name of the resource group to create or update. * @param parameters Parameters supplied to the create or update a resource group. @@ -508,8 +757,8 @@ private ServiceResponse getDelegate(Response r * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ResourceGroupInner object if successful. */ - public ResourceGroupInner update(String resourceGroupName, ResourceGroupPatchableInner parameters) { - return updateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); + public ResourceGroupInner patch(String resourceGroupName, ResourceGroupInner parameters) { + return patchWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); } /** @@ -522,8 +771,8 @@ public ResourceGroupInner update(String resourceGroupName, ResourceGroupPatchabl * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, ResourceGroupPatchableInner parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); + public ServiceFuture patchAsync(String resourceGroupName, ResourceGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); } /** @@ -535,8 +784,8 @@ public ServiceFuture updateAsync(String resourceGroupName, R * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ResourceGroupInner object */ - public Observable updateAsync(String resourceGroupName, ResourceGroupPatchableInner parameters) { - return updateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1, ResourceGroupInner>() { + public Observable patchAsync(String resourceGroupName, ResourceGroupInner parameters) { + return patchWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1, ResourceGroupInner>() { @Override public ResourceGroupInner call(ServiceResponse response) { return response.body(); @@ -553,7 +802,7 @@ public ResourceGroupInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ResourceGroupInner object */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, ResourceGroupPatchableInner parameters) { + public Observable> patchWithServiceResponseAsync(String resourceGroupName, ResourceGroupInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -567,12 +816,12 @@ public Observable> updateWithServiceResponse throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(parameters); - return service.update(resourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.patch(resourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = updateDelegate(response); + ServiceResponse clientResponse = patchDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -581,7 +830,7 @@ public Observable> call(Response updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse patchDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -894,6 +1143,117 @@ private ServiceResponse> listDelegate(Response listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Gets all the resource groups for a subscription. * diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceManagementClientImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceManagementClientImpl.java index 878acd67afe..f49974af9f4 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceManagementClientImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceManagementClientImpl.java @@ -159,29 +159,29 @@ public ProvidersInner providers() { } /** - * The ResourcesInner object to access its operations. + * The ResourceGroupsInner object to access its operations. */ - private ResourcesInner resources; + private ResourceGroupsInner resourceGroups; /** - * Gets the ResourcesInner object to access its operations. - * @return the ResourcesInner object. + * Gets the ResourceGroupsInner object to access its operations. + * @return the ResourceGroupsInner object. */ - public ResourcesInner resources() { - return this.resources; + public ResourceGroupsInner resourceGroups() { + return this.resourceGroups; } /** - * The ResourceGroupsInner object to access its operations. + * The ResourcesInner object to access its operations. */ - private ResourceGroupsInner resourceGroups; + private ResourcesInner resources; /** - * Gets the ResourceGroupsInner object to access its operations. - * @return the ResourceGroupsInner object. + * Gets the ResourcesInner object to access its operations. + * @return the ResourcesInner object. */ - public ResourceGroupsInner resourceGroups() { - return this.resourceGroups; + public ResourcesInner resources() { + return this.resources; } /** @@ -241,14 +241,14 @@ public ResourceManagementClientImpl(RestClient restClient) { } protected void initialize() { - this.apiVersion = "2017-05-10"; + this.apiVersion = "2016-09-01"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.deployments = new DeploymentsInner(restClient().retrofit(), this); this.providers = new ProvidersInner(restClient().retrofit(), this); - this.resources = new ResourcesInner(restClient().retrofit(), this); this.resourceGroups = new ResourceGroupsInner(restClient().retrofit(), this); + this.resources = new ResourcesInner(restClient().retrofit(), this); this.tags = new TagsInner(restClient().retrofit(), this); this.deploymentOperations = new DeploymentOperationsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); @@ -261,6 +261,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "ResourceManagementClient", "2017-05-10"); + return String.format("%s (%s, %s)", super.userAgent(), "ResourceManagementClient", "2016-09-01"); } } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourcesInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourcesInner.java index 8c9fec5665e..858ee6f91ab 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourcesInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourcesInner.java @@ -8,7 +8,6 @@ package com.microsoft.azure.management.resources.implementation; -import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; @@ -43,7 +42,7 @@ * An instance of this class provides access to all the operations defined * in Resources. */ -public class ResourcesInner implements InnerSupportsListing { +public class ResourcesInner { /** The Retrofit service to perform REST calls. */ private ResourcesService service; /** The service client containing this operation class. */ @@ -65,10 +64,6 @@ public ResourcesInner(Retrofit retrofit, ResourceManagementClientImpl client) { * used by Retrofit to perform actually REST calls. */ interface ResourcesService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources listByResourceGroup" }) - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources") - Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$expand") String expand, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources moveResources" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources") Observable> moveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfoInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -77,14 +72,6 @@ interface ResourcesService { @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources") Observable> beginMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfoInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources validateMoveResources" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources") - Observable> validateMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfoInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources beginValidateMoveResources" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources") - Observable> beginValidateMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfoInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources list" }) @GET("subscriptions/{subscriptionId}/resources") Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$expand") String expand, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -153,262 +140,17 @@ interface ResourcesService { @GET("{resourceId}") Observable> getById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources listByResourceGroupNext" }) - @GET - Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<GenericResourceInner> object if successful. - */ - public PagedList listByResourceGroup(final String resourceGroupName) { - ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listByResourceGroupSinglePageAsync(resourceGroupName), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<GenericResourceInner> object - */ - public Observable> listByResourceGroupAsync(final String resourceGroupName) { - return listByResourceGroupWithServiceResponseAsync(resourceGroupName) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<GenericResourceInner> object - */ - public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { - return listByResourceGroupSinglePageAsync(resourceGroupName) - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - final String filter = null; - final String expand = null; - final Integer top = null; - return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listByResourceGroupDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @param filter The filter to apply on the operation. - * @param expand The $expand query parameter - * @param top The number of results to return. If null is passed, returns all resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<GenericResourceInner> object if successful. - */ - public PagedList listByResourceGroup(final String resourceGroupName, final String filter, final String expand, final Integer top) { - ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top).toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @param filter The filter to apply on the operation. - * @param expand The $expand query parameter - * @param top The number of results to return. If null is passed, returns all resources. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top, final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @param filter The filter to apply on the operation. - * @param expand The $expand query parameter - * @param top The number of results to return. If null is passed, returns all resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<GenericResourceInner> object - */ - public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { - return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, expand, top) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Get all the resources for a resource group. - * - * @param resourceGroupName The resource group with the resources to get. - * @param filter The filter to apply on the operation. - * @param expand The $expand query parameter - * @param top The number of results to return. If null is passed, returns all resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<GenericResourceInner> object - */ - public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { - return listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top) - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Get all the resources for a resource group. - * - ServiceResponse> * @param resourceGroupName The resource group with the resources to get. - ServiceResponse> * @param filter The filter to apply on the operation. - ServiceResponse> * @param expand The $expand query parameter - ServiceResponse> * @param top The number of results to return. If null is passed, returns all resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listByResourceGroupDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - /** * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param sourceResourceGroupName The name of the resource group containing the rsources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server @@ -422,7 +164,7 @@ public void moveResources(String sourceResourceGroupName, ResourcesMoveInfoInner * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param sourceResourceGroupName The name of the resource group containing the rsources to move. * @param parameters Parameters for moving resources. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -436,7 +178,7 @@ public ServiceFuture moveResourcesAsync(String sourceResourceGroupName, Re * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param sourceResourceGroupName The name of the resource group containing the rsources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -454,7 +196,7 @@ public Void call(ServiceResponse response) { * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param sourceResourceGroupName The name of the resource group containing the rsources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -481,7 +223,7 @@ public Observable> moveResourcesWithServiceResponseAsync(S * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param sourceResourceGroupName The name of the resource group containing the rsources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server @@ -495,7 +237,7 @@ public void beginMoveResources(String sourceResourceGroupName, ResourcesMoveInfo * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param sourceResourceGroupName The name of the resource group containing the rsources to move. * @param parameters Parameters for moving resources. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -509,7 +251,7 @@ public ServiceFuture beginMoveResourcesAsync(String sourceResourceGroupNam * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param sourceResourceGroupName The name of the resource group containing the rsources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -527,7 +269,7 @@ public Void call(ServiceResponse response) { * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param sourceResourceGroupName The name of the resource group containing the rsources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -568,171 +310,6 @@ private ServiceResponse beginMoveResourcesDelegate(Response .build(response); } - /** - * Validates whether resources can be moved from one resource group to another resource group. - * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. - * - * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. - * @param parameters Parameters for moving resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - public void validateMoveResources(String sourceResourceGroupName, ResourcesMoveInfoInner parameters) { - validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body(); - } - - /** - * Validates whether resources can be moved from one resource group to another resource group. - * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. - * - * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. - * @param parameters Parameters for moving resources. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfoInner parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); - } - - /** - * Validates whether resources can be moved from one resource group to another resource group. - * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. - * - * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. - * @param parameters Parameters for moving resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfoInner parameters) { - return validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Validates whether resources can be moved from one resource group to another resource group. - * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. - * - * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. - * @param parameters Parameters for moving resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable> validateMoveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfoInner parameters) { - if (sourceResourceGroupName == null) { - throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); - } - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - Validator.validate(parameters); - Observable> observable = service.validateMoveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - - /** - * Validates whether resources can be moved from one resource group to another resource group. - * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. - * - * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. - * @param parameters Parameters for moving resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - public void beginValidateMoveResources(String sourceResourceGroupName, ResourcesMoveInfoInner parameters) { - beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().single().body(); - } - - /** - * Validates whether resources can be moved from one resource group to another resource group. - * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. - * - * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. - * @param parameters Parameters for moving resources. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture beginValidateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfoInner parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); - } - - /** - * Validates whether resources can be moved from one resource group to another resource group. - * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. - * - * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. - * @param parameters Parameters for moving resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. - */ - public Observable beginValidateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfoInner parameters) { - return beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Validates whether resources can be moved from one resource group to another resource group. - * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. - * - * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. - * @param parameters Parameters for moving resources. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. - */ - public Observable> beginValidateMoveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfoInner parameters) { - if (sourceResourceGroupName == null) { - throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); - } - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - Validator.validate(parameters); - return service.beginValidateMoveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginValidateMoveResourcesDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse beginValidateMoveResourcesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(202, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) - .register(409, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - /** * Get all the resources in a subscription. * @@ -2456,117 +2033,6 @@ private ServiceResponse getByIdDelegate(Response listByResourceGroupNext(final String nextPageLink) { - ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Get all the resources for a resource group. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listByResourceGroupNextSinglePageAsync(nextPageLink), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Get all the resources for a resource group. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<GenericResourceInner> object - */ - public Observable> listByResourceGroupNextAsync(final String nextPageLink) { - return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Get all the resources for a resource group. - * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<GenericResourceInner> object - */ - public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Get all the resources for a resource group. - * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { - if (nextPageLink == null) { - throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); - } - String nextUrl = String.format("%s", nextPageLink); - return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listByResourceGroupNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - /** * Get all the resources in a subscription. * diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/TagDetailsInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/TagDetailsInner.java index 5f015d0b217..d4e7385e46d 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/TagDetailsInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/TagDetailsInner.java @@ -19,7 +19,7 @@ public class TagDetailsInner { /** * The tag ID. */ - @JsonProperty(value = "id") + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /** @@ -50,17 +50,6 @@ public String id() { return this.id; } - /** - * Set the id value. - * - * @param id the id value to set - * @return the TagDetailsInner object itself. - */ - public TagDetailsInner withId(String id) { - this.id = id; - return this; - } - /** * Get the tagName value. * diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/TagValueInner.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/TagValueInner.java index 9117c6dd722..214c5064428 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/TagValueInner.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/TagValueInner.java @@ -18,7 +18,7 @@ public class TagValueInner { /** * The tag ID. */ - @JsonProperty(value = "id") + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /** @@ -42,17 +42,6 @@ public String id() { return this.id; } - /** - * Set the id value. - * - * @param id the id value to set - * @return the TagValueInner object itself. - */ - public TagValueInner withId(String id) { - this.id = id; - return this; - } - /** * Get the tagValue value. * diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/package-info.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/package-info.java index 6841e4852bb..d053f24a04d 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/package-info.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementation classes for ResourceManagementClient. - * Provides operations for working with resources and resource groups. + * This package contains the implementation classes for SubscriptionClient. + * All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. */ package com.microsoft.azure.management.resources.implementation; diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/package-info.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/package-info.java index 35103a8481c..43f858c49df 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/package-info.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the classes for ResourceManagementClient. - * Provides operations for working with resources and resource groups. + * This package contains the classes for SubscriptionClient. + * All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. */ package com.microsoft.azure.management.resources;