From 47c14935ce50cd34473e4f8ba15e17b31011a9bb Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Wed, 16 Sep 2020 08:09:45 +0000 Subject: [PATCH] Generated from c05daca5376949c1800f04878dea5656071cb748 --- sdk/resources/mgmt-v2019_07_01/pom.xml | 6 +- .../v2019_07_01/GenericResource.java | 2 +- .../v2019_07_01/GenericResourceExpanded.java | 92 +++ .../resources/v2019_07_01/Resources.java | 4 +- .../resources/v2019_07_01/TagOperations.java | 67 ++ .../implementation/DeploymentsImpl.java | 2 +- .../implementation/DeploymentsInner.java | 2 - .../GenericResourceExpandedImpl.java | 105 +++ .../GenericResourceExpandedInner.java | 66 ++ .../implementation/GenericResourceImpl.java | 6 +- .../ResourceManagementClientImpl.java | 16 +- .../implementation/ResourcesImpl.java | 27 +- .../implementation/ResourcesInner.java | 324 ++++----- .../implementation/ResourcesManager.java | 14 +- .../implementation/TagOperationsImpl.java | 91 +++ .../implementation/TagOperationsInner.java | 646 ++++++++++++++++++ 16 files changed, 1266 insertions(+), 204 deletions(-) create mode 100644 sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/GenericResourceExpanded.java create mode 100644 sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/TagOperations.java create mode 100644 sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceExpandedImpl.java create mode 100644 sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceExpandedInner.java create mode 100644 sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/TagOperationsImpl.java create mode 100644 sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/TagOperationsInner.java diff --git a/sdk/resources/mgmt-v2019_07_01/pom.xml b/sdk/resources/mgmt-v2019_07_01/pom.xml index 062901386e848..cc3c633e4a67e 100644 --- a/sdk/resources/mgmt-v2019_07_01/pom.xml +++ b/sdk/resources/mgmt-v2019_07_01/pom.xml @@ -11,8 +11,8 @@ com.microsoft.azure azure-arm-parent - 1.2.0 - ../../parents/azure-arm-parent + 1.1.0 + ../../../pom.management.xml azure-mgmt-resources 1.0.0-beta @@ -46,12 +46,10 @@ com.microsoft.azure azure-client-runtime - 1.6.14 com.microsoft.azure azure-arm-client-runtime - 1.6.14 junit diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/GenericResource.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/GenericResource.java index d68edb2e4be55..8e3ac300700ed 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/GenericResource.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/GenericResource.java @@ -9,9 +9,9 @@ package com.microsoft.azure.management.resources.v2019_07_01; import com.microsoft.azure.arm.model.HasInner; -import com.microsoft.azure.management.resources.v2019_07_01.implementation.GenericResourceInner; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.resources.v2019_07_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_07_01.implementation.GenericResourceInner; import java.util.Map; /** diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/GenericResourceExpanded.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/GenericResourceExpanded.java new file mode 100644 index 0000000000000..8f74d32bd265a --- /dev/null +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/GenericResourceExpanded.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_07_01.implementation.GenericResourceExpandedInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_07_01.implementation.ResourcesManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing GenericResourceExpanded. + */ +public interface GenericResourceExpanded extends HasInner, HasManager { + /** + * @return the changedTime value. + */ + DateTime changedTime(); + + /** + * @return the createdTime value. + */ + DateTime createdTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + Identity identity(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the managedBy value. + */ + String managedBy(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the plan value. + */ + Plan plan(); + + /** + * @return the properties value. + */ + Object properties(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/Resources.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/Resources.java index d3dc7ee55ac18..0e28a4e72ca51 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/Resources.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/Resources.java @@ -24,7 +24,7 @@ public interface Resources extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listAsync(); + Observable listAsync(); /** * Checks by ID whether a resource exists. @@ -85,7 +85,7 @@ public interface Resources extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByResourceGroupAsync(final String resourceGroupName); + Observable listByResourceGroupAsync(final String resourceGroupName); /** * Moves resources from one resource group to another resource group. diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/TagOperations.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/TagOperations.java new file mode 100644 index 0000000000000..01d2b3085ec83 --- /dev/null +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/TagOperations.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_07_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_07_01.TagDetails; +import rx.Completable; + +/** + * Type representing TagOperations. + */ +public interface TagOperations { + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String tagName); + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String tagName); + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteValueAsync(String tagName, String tagValue); + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateValueAsync(String tagName, String tagValue); + +} diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/DeploymentsImpl.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/DeploymentsImpl.java index 8576f94b7c803..84bcd08519232 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/DeploymentsImpl.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/DeploymentsImpl.java @@ -516,7 +516,7 @@ public Observable getByResourceGroupAsync(String resourceGro return this.getInnerAsync(resourceGroupName, name).flatMap(new Func1> () { @Override public Observable call(DeploymentExtendedInner innerT) { - if (innerT == null) { + if (inner == null) { return Observable.empty(); } else { return Observable.just((DeploymentExtended)wrapModel(innerT)); diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/DeploymentsInner.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/DeploymentsInner.java index 88b2cffac7536..afaa4053c666b 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/DeploymentsInner.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/DeploymentsInner.java @@ -45,8 +45,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceExpandedImpl.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceExpandedImpl.java new file mode 100644 index 0000000000000..ab9860e8f9c1a --- /dev/null +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceExpandedImpl.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_07_01.implementation; + +import com.microsoft.azure.management.resources.v2019_07_01.GenericResourceExpanded; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.resources.v2019_07_01.Identity; +import com.microsoft.azure.management.resources.v2019_07_01.Plan; +import com.microsoft.azure.management.resources.v2019_07_01.Sku; +import java.util.Map; + +class GenericResourceExpandedImpl extends WrapperImpl implements GenericResourceExpanded { + private final ResourcesManager manager; + + GenericResourceExpandedImpl(GenericResourceExpandedInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public DateTime changedTime() { + return this.inner().changedTime(); + } + + @Override + public DateTime createdTime() { + return this.inner().createdTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String managedBy() { + return this.inner().managedBy(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Plan plan() { + return this.inner().plan(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceExpandedInner.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceExpandedInner.java new file mode 100644 index 0000000000000..7863bd5a9890f --- /dev/null +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceExpandedInner.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_07_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource information. + */ +public class GenericResourceExpandedInner extends GenericResourceInner { + /** + * The created time of the resource. This is only present if requested via + * the $expand query parameter. + */ + @JsonProperty(value = "createdTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdTime; + + /** + * The changed time of the resource. This is only present if requested via + * the $expand query parameter. + */ + @JsonProperty(value = "changedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime changedTime; + + /** + * The provisioning state of the resource. This is only present if + * requested via the $expand query parameter. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the created time of the resource. This is only present if requested via the $expand query parameter. + * + * @return the createdTime value + */ + public DateTime createdTime() { + return this.createdTime; + } + + /** + * Get the changed time of the resource. This is only present if requested via the $expand query parameter. + * + * @return the changedTime value + */ + public DateTime changedTime() { + return this.changedTime; + } + + /** + * Get the provisioning state of the resource. This is only present if requested via the $expand query parameter. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceImpl.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceImpl.java index 68f06d9bc6ef5..f118b9bb69275 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceImpl.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/GenericResourceImpl.java @@ -10,7 +10,6 @@ import com.microsoft.azure.management.resources.v2019_07_01.GenericResource; import com.microsoft.azure.arm.model.implementation.WrapperImpl; -import rx.Observable; import com.microsoft.azure.management.resources.v2019_07_01.Identity; import com.microsoft.azure.management.resources.v2019_07_01.Plan; import com.microsoft.azure.management.resources.v2019_07_01.Sku; @@ -18,8 +17,7 @@ class GenericResourceImpl extends WrapperImpl implements GenericResource { private final ResourcesManager manager; - - GenericResourceImpl(GenericResourceInner inner, ResourcesManager manager) { + GenericResourceImpl(GenericResourceInner inner, ResourcesManager manager) { super(inner); this.manager = manager; } @@ -29,8 +27,6 @@ public ResourcesManager manager() { return this.manager; } - - @Override public String id() { return this.inner().id(); diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourceManagementClientImpl.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourceManagementClientImpl.java index 922db9387b4c5..059c9a7293132 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourceManagementClientImpl.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourceManagementClientImpl.java @@ -10,6 +10,8 @@ import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; @@ -198,16 +200,16 @@ public ResourceGroupsInner resourceGroups() { } /** - * The TagsInner object to access its operations. + * The TagOperationsInner object to access its operations. */ - private TagsInner tags; + private TagOperationsInner tagOperations; /** - * Gets the TagsInner object to access its operations. - * @return the TagsInner object. + * Gets the TagOperationsInner object to access its operations. + * @return the TagOperationsInner object. */ - public TagsInner tags() { - return this.tags; + public TagOperationsInner tagOperations() { + return this.tagOperations; } /** @@ -263,7 +265,7 @@ protected void initialize() { this.providers = new ProvidersInner(restClient().retrofit(), this); this.resources = new ResourcesInner(restClient().retrofit(), this); this.resourceGroups = new ResourceGroupsInner(restClient().retrofit(), this); - this.tags = new TagsInner(restClient().retrofit(), this); + this.tagOperations = new TagOperationsInner(restClient().retrofit(), this); this.deploymentOperations = new DeploymentOperationsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesImpl.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesImpl.java index cfcbee229ace6..7d0f01b9c3f4d 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesImpl.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesImpl.java @@ -15,6 +15,7 @@ import rx.functions.Func1; import com.microsoft.azure.Page; import rx.Completable; +import com.microsoft.azure.management.resources.v2019_07_01.GenericResourceExpanded; import com.microsoft.azure.management.resources.v2019_07_01.GenericResource; import com.microsoft.azure.management.resources.v2019_07_01.ResourcesMoveInfo; @@ -30,24 +31,24 @@ public ResourcesManager manager() { return this.manager; } - private GenericResourceImpl wrapModel(GenericResourceInner inner) { - return new GenericResourceImpl(inner, manager()); + private GenericResourceExpandedImpl wrapModel(GenericResourceExpandedInner inner) { + return new GenericResourceExpandedImpl(inner, manager()); } @Override - public Observable listAsync() { + public Observable listAsync() { ResourcesInner client = this.inner(); return client.listAsync() - .flatMapIterable(new Func1, Iterable>() { + .flatMapIterable(new Func1, Iterable>() { @Override - public Iterable call(Page page) { + public Iterable call(Page page) { return page.items(); } }) - .map(new Func1() { + .map(new Func1() { @Override - public GenericResource call(GenericResourceInner inner) { - return new GenericResourceImpl(inner, manager()); + public GenericResourceExpanded call(GenericResourceExpandedInner inner) { + return new GenericResourceExpandedImpl(inner, manager()); } }); } @@ -101,18 +102,18 @@ public GenericResource call(GenericResourceInner inner) { } @Override - public Observable listByResourceGroupAsync(final String resourceGroupName) { + public Observable listByResourceGroupAsync(final String resourceGroupName) { ResourcesInner client = this.inner(); return client.listByResourceGroupAsync(resourceGroupName) - .flatMapIterable(new Func1, Iterable>() { + .flatMapIterable(new Func1, Iterable>() { @Override - public Iterable call(Page page) { + public Iterable call(Page page) { return page.items(); } }) - .map(new Func1() { + .map(new Func1() { @Override - public GenericResource call(GenericResourceInner inner) { + public GenericResourceExpanded call(GenericResourceExpandedInner inner) { return wrapModel(inner); } }); diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesInner.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesInner.java index d3bc92805b1ab..ff7d78121cb7f 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesInner.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesInner.java @@ -44,7 +44,7 @@ * An instance of this class provides access to all the operations defined * in Resources. */ -public class ResourcesInner implements InnerSupportsListing { +public class ResourcesInner implements InnerSupportsListing { /** The Retrofit service to perform REST calls. */ private ResourcesService service; /** The service client containing this operation class. */ @@ -171,13 +171,13 @@ interface ResourcesService { * @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. + * @return the PagedList<GenericResourceExpandedInner> object if successful. */ - public PagedList listByResourceGroup(final String resourceGroupName) { - ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { + public Page nextPage(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; @@ -191,12 +191,12 @@ public Page nextPage(String nextPageLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( listByResourceGroupSinglePageAsync(resourceGroupName), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { + public Observable>> call(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink); } }, @@ -208,13 +208,13 @@ public Observable>> call(String nextP * * @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 + * @return the observable to the PagedList<GenericResourceExpandedInner> object */ - public Observable> listByResourceGroupAsync(final String resourceGroupName) { + public Observable> listByResourceGroupAsync(final String resourceGroupName) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName) - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -225,13 +225,13 @@ public Page call(ServiceResponse>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { return listByResourceGroupSinglePageAsync(resourceGroupName) - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); @@ -246,9 +246,9 @@ public Observable>> call(ServiceRespo * * @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. + * @return the PagedList<GenericResourceExpandedInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -262,12 +262,12 @@ public Observable>> listByResourceGro 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>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -280,18 +280,18 @@ public Observable>> call(Response 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()) { + 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) { + public Page nextPage(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; @@ -302,18 +302,18 @@ public Page nextPage(String nextPageLink) { * * @param resourceGroupName The resource group with the resources to get. * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. - * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. * @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) { + 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>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { + public Observable>> call(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink); } }, @@ -325,16 +325,16 @@ public Observable>> call(String nextP * * @param resourceGroupName The resource group with the resources to get. * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. - * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. * @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 + * @return the observable to the PagedList<GenericResourceExpandedInner> object */ - public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + 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>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -345,16 +345,16 @@ public Page call(ServiceResponse>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + 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>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); @@ -367,14 +367,14 @@ public Observable>> call(ServiceRespo /** * 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.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. - ServiceResponse> * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime - ServiceResponse> * @param top The number of results to return. If null is passed, returns all resources. + ServiceResponse> * @param resourceGroupName The resource group with the resources to get. + ServiceResponse> * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + ServiceResponse> * @param expand Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + 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. + * @return the PagedList<GenericResourceExpandedInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + 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."); } @@ -385,12 +385,12 @@ public Observable>> listByResourceGro 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>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -398,9 +398,9 @@ public Observable>> call(Response> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + 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); } @@ -739,13 +739,13 @@ private ServiceResponse beginValidateMoveResourcesDelegate(Response list() { - ServiceResponse> response = listSinglePageAsync().toBlocking().single(); - return new PagedList(response.body()) { + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { + public Page nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; @@ -758,12 +758,12 @@ public Page nextPage(String nextPageLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { + public Observable>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, @@ -774,13 +774,13 @@ public Observable>> call(String nextP * Get all the resources in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<GenericResourceInner> object + * @return the observable to the PagedList<GenericResourceExpandedInner> object */ - public Observable> listAsync() { + public Observable> listAsync() { return listWithServiceResponseAsync() - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -790,13 +790,13 @@ public Page call(ServiceResponse>> listWithServiceResponseAsync() { + public Observable>> listWithServiceResponseAsync() { return listSinglePageAsync() - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); @@ -810,9 +810,9 @@ public Observable>> call(ServiceRespo * Get all the resources in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<GenericResourceExpandedInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listSinglePageAsync() { + public Observable>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -823,12 +823,12 @@ public Observable>> listSinglePageAsy final String expand = null; final Integer top = null; return service.list(this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -840,18 +840,18 @@ public Observable>> call(Response list(final String filter, final String expand, final Integer top) { - ServiceResponse> response = listSinglePageAsync(filter, expand, top).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList list(final String filter, final String expand, final Integer top) { + ServiceResponse> response = listSinglePageAsync(filter, expand, top).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { + public Page nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; @@ -861,18 +861,18 @@ public Page nextPage(String nextPageLink) { * Get all the resources in a subscription. * * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. - * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. * @param top The number of results to return. If null is passed, returns all resource groups. * @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 String filter, final String expand, final Integer top, final ListOperationCallback serviceCallback) { + public ServiceFuture> listAsync(final String filter, final String expand, final Integer top, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(filter, expand, top), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { + public Observable>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, @@ -883,16 +883,16 @@ public Observable>> call(String nextP * Get all the resources in a subscription. * * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. - * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. * @param top The number of results to return. If null is passed, returns all resource groups. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<GenericResourceInner> object + * @return the observable to the PagedList<GenericResourceExpandedInner> object */ - public Observable> listAsync(final String filter, final String expand, final Integer top) { + public Observable> listAsync(final String filter, final String expand, final Integer top) { return listWithServiceResponseAsync(filter, expand, top) - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -902,16 +902,16 @@ public Page call(ServiceResponse>> listWithServiceResponseAsync(final String filter, final String expand, final Integer top) { + public Observable>> listWithServiceResponseAsync(final String filter, final String expand, final Integer top) { return listSinglePageAsync(filter, expand, top) - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); @@ -924,13 +924,13 @@ public Observable>> call(ServiceRespo /** * Get all the resources in a subscription. * - ServiceResponse> * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. - ServiceResponse> * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime - ServiceResponse> * @param top The number of results to return. If null is passed, returns all resource groups. + ServiceResponse> * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + ServiceResponse> * @param expand Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + ServiceResponse> * @param top The number of results to return. If null is passed, returns all resource groups. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<GenericResourceExpandedInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listSinglePageAsync(final String filter, final String expand, final Integer top) { + public Observable>> listSinglePageAsync(final String filter, final String expand, final Integer top) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -938,12 +938,12 @@ public Observable>> listSinglePageAsy throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -951,9 +951,9 @@ public Observable>> call(Response> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, 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); } @@ -2463,13 +2463,13 @@ private ServiceResponse getByIdDelegate(Response listByResourceGroupNext(final String nextPageLink) { - ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { + public Page nextPage(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; @@ -2484,12 +2484,12 @@ public Page nextPage(String nextPageLink) { * @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) { + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( listByResourceGroupNextSinglePageAsync(nextPageLink), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { + public Observable>> call(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink); } }, @@ -2501,13 +2501,13 @@ public Observable>> call(String nextP * * @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 + * @return the observable to the PagedList<GenericResourceExpandedInner> object */ - public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -2518,13 +2518,13 @@ public Page call(ServiceResponse>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); @@ -2537,22 +2537,22 @@ public Observable>> call(ServiceRespo /** * Get all the resources for a resource group. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + 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. + * @return the PagedList<GenericResourceExpandedInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + 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>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2560,9 +2560,9 @@ public Observable>> call(Response> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + 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); } @@ -2574,13 +2574,13 @@ private ServiceResponse> listByResourceGroupNextD * @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. + * @return the PagedList<GenericResourceExpandedInner> object if successful. */ - public PagedList listNext(final String nextPageLink) { - ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { + public Page nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; @@ -2595,12 +2595,12 @@ public Page nextPage(String nextPageLink) { * @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) { + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( listNextSinglePageAsync(nextPageLink), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { + public Observable>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, @@ -2612,13 +2612,13 @@ public Observable>> call(String nextP * * @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 + * @return the observable to the PagedList<GenericResourceExpandedInner> object */ - public Observable> listNextAsync(final String nextPageLink) { + public Observable> listNextAsync(final String nextPageLink) { return listNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -2629,13 +2629,13 @@ public Page call(ServiceResponse>> listNextWithServiceResponseAsync(final String nextPageLink) { + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { return listNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); @@ -2648,22 +2648,22 @@ public Observable>> call(ServiceRespo /** * Get all the resources in a subscription. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + 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. + * @return the PagedList<GenericResourceExpandedInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listNextSinglePageAsync(final String nextPageLink) { + public Observable>> listNextSinglePageAsync(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.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2671,9 +2671,9 @@ public Observable>> call(Response> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + 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(CloudException.class) .build(response); } diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesManager.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesManager.java index cb8b833fbd515..ae30cd3176f21 100644 --- a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesManager.java +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/ResourcesManager.java @@ -21,7 +21,7 @@ import com.microsoft.azure.management.resources.v2019_07_01.Providers; import com.microsoft.azure.management.resources.v2019_07_01.Resources; import com.microsoft.azure.management.resources.v2019_07_01.ResourceGroups; -import com.microsoft.azure.management.resources.v2019_07_01.Tags; +import com.microsoft.azure.management.resources.v2019_07_01.TagOperations; import com.microsoft.azure.management.resources.v2019_07_01.DeploymentOperations; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -35,7 +35,7 @@ public final class ResourcesManager extends ManagerCore implements TagOperations { + private final ResourcesManager manager; + + TagOperationsImpl(ResourcesManager manager) { + super(manager.inner().tagOperations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private TagDetailsImpl wrapTagDetailsModel(TagDetailsInner inner) { + return new TagDetailsImpl(inner, manager()); + } + + @Override + public Observable listAsync() { + TagOperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagDetails call(TagDetailsInner inner) { + return wrapTagDetailsModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String tagName) { + TagOperationsInner client = this.inner(); + return client.deleteAsync(tagName).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String tagName) { + TagOperationsInner client = this.inner(); + return client.createOrUpdateAsync(tagName) + .map(new Func1() { + @Override + public TagDetails call(TagDetailsInner inner) { + return new TagDetailsImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteValueAsync(String tagName, String tagValue) { + TagOperationsInner client = this.inner(); + return client.deleteValueAsync(tagName, tagValue).toCompletable(); + } + + @Override + public Observable createOrUpdateValueAsync(String tagName, String tagValue) { + TagOperationsInner client = this.inner(); + return client.createOrUpdateValueAsync(tagName, tagValue) + .map(new Func1() { + @Override + public TagValue call(TagValueInner inner) { + return new TagValueImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/TagOperationsInner.java b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/TagOperationsInner.java new file mode 100644 index 0000000000000..f41573b985552 --- /dev/null +++ b/sdk/resources/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/resources/v2019_07_01/implementation/TagOperationsInner.java @@ -0,0 +1,646 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_07_01.implementation; + +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.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TagOperations. + */ +public class TagOperationsInner { + /** The Retrofit service to perform REST calls. */ + private TagOperationsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of TagOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TagOperationsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(TagOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TagOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface TagOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_07_01.TagOperations deleteValue" }) + @HTTP(path = "subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", method = "DELETE", hasBody = true) + Observable> deleteValue(@Path("tagName") String tagName, @Path("tagValue") String tagValue, @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.v2019_07_01.TagOperations createOrUpdateValue" }) + @PUT("subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}") + Observable> createOrUpdateValue(@Path("tagName") String tagName, @Path("tagValue") String tagValue, @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.v2019_07_01.TagOperations createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/tagNames/{tagName}") + Observable> createOrUpdate(@Path("tagName") String tagName, @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.v2019_07_01.TagOperations delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/tagNames/{tagName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("tagName") String tagName, @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.v2019_07_01.TagOperations list" }) + @GET("subscriptions/{subscriptionId}/tagNames") + 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.v2019_07_01.TagOperations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @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 deleteValue(String tagName, String tagValue) { + deleteValueWithServiceResponseAsync(tagName, tagValue).toBlocking().single().body(); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @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 deleteValueAsync(String tagName, String tagValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteValueWithServiceResponseAsync(tagName, tagValue), serviceCallback); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteValueAsync(String tagName, String tagValue) { + return deleteValueWithServiceResponseAsync(tagName, tagValue).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteValueWithServiceResponseAsync(String tagName, String tagValue) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); + } + if (tagValue == null) { + throw new IllegalArgumentException("Parameter tagValue 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.deleteValue(tagName, tagValue, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteValueDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteValueDelegate(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); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 TagValueInner object if successful. + */ + public TagValueInner createOrUpdateValue(String tagName, String tagValue) { + return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).toBlocking().single().body(); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 createOrUpdateValueAsync(String tagName, String tagValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateValueWithServiceResponseAsync(tagName, tagValue), serviceCallback); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagValueInner object + */ + public Observable createOrUpdateValueAsync(String tagName, String tagValue) { + return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).map(new Func1, TagValueInner>() { + @Override + public TagValueInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagValueInner object + */ + public Observable> createOrUpdateValueWithServiceResponseAsync(String tagName, String tagValue) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); + } + if (tagValue == null) { + throw new IllegalArgumentException("Parameter tagValue 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.createOrUpdateValue(tagName, tagValue, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateValueDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateValueDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @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 TagDetailsInner object if successful. + */ + public TagDetailsInner createOrUpdate(String tagName) { + return createOrUpdateWithServiceResponseAsync(tagName).toBlocking().single().body(); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @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 createOrUpdateAsync(String tagName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(tagName), serviceCallback); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDetailsInner object + */ + public Observable createOrUpdateAsync(String tagName) { + return createOrUpdateWithServiceResponseAsync(tagName).map(new Func1, TagDetailsInner>() { + @Override + public TagDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDetailsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String tagName) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName 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.createOrUpdate(tagName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @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 delete(String tagName) { + deleteWithServiceResponseAsync(tagName).toBlocking().single().body(); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @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 deleteAsync(String tagName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(tagName), serviceCallback); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String tagName) { + return deleteWithServiceResponseAsync(tagName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String tagName) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName 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.delete(tagName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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(CloudException.class) + .build(response); + } + + /** + * Gets the names and values of all resource tags that are defined in 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<TagDetailsInner> 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 the names and values of all resource tags that are defined in 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 the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> 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 the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagDetailsInner> 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.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 the names and values of all resource tags that are defined in 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<TagDetailsInner> 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 the names and values of all resource tags that are defined in 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 the names and values of all resource tags that are defined in 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<TagDetailsInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the names and values of all resource tags that are defined in 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<TagDetailsInner> 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 the names and values of all resource tags that are defined in 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<TagDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(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.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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(CloudException.class) + .build(response); + } + +}