diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvent.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvent.java new file mode 100644 index 0000000000000..9de88b27d2607 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvent.java @@ -0,0 +1,172 @@ +/** + * 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.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyEventInner; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing PolicyEvent. + */ +public interface PolicyEvent extends HasInner, HasManager { + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the effectiveParameters value. + */ + String effectiveParameters(); + + /** + * @return the isCompliant value. + */ + Boolean isCompliant(); + + /** + * @return the managementGroupIds value. + */ + String managementGroupIds(); + + /** + * @return the odatacontext value. + */ + String odatacontext(); + + /** + * @return the odataid value. + */ + String odataid(); + + /** + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * @return the policyAssignmentName value. + */ + String policyAssignmentName(); + + /** + * @return the policyAssignmentOwner value. + */ + String policyAssignmentOwner(); + + /** + * @return the policyAssignmentParameters value. + */ + String policyAssignmentParameters(); + + /** + * @return the policyAssignmentScope value. + */ + String policyAssignmentScope(); + + /** + * @return the policyDefinitionAction value. + */ + String policyDefinitionAction(); + + /** + * @return the policyDefinitionCategory value. + */ + String policyDefinitionCategory(); + + /** + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * @return the policyDefinitionName value. + */ + String policyDefinitionName(); + + /** + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * @return the policySetDefinitionCategory value. + */ + String policySetDefinitionCategory(); + + /** + * @return the policySetDefinitionId value. + */ + String policySetDefinitionId(); + + /** + * @return the policySetDefinitionName value. + */ + String policySetDefinitionName(); + + /** + * @return the policySetDefinitionOwner value. + */ + String policySetDefinitionOwner(); + + /** + * @return the policySetDefinitionParameters value. + */ + String policySetDefinitionParameters(); + + /** + * @return the principalOid value. + */ + String principalOid(); + + /** + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the resourceLocation value. + */ + String resourceLocation(); + + /** + * @return the resourceTags value. + */ + String resourceTags(); + + /** + * @return the resourceType value. + */ + String resourceType(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the tenantId value. + */ + String tenantId(); + + /** + * @return the timestamp value. + */ + DateTime timestamp(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java index b2473689228e8..15832896ab84b 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java @@ -21,7 +21,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForManagementGroupAsync(String managementGroupName); + Observable listQueryResultsForManagementGroupAsync(final String managementGroupName); /** * Queries policy events for the resources under the subscription. @@ -30,7 +30,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForSubscriptionAsync(String subscriptionId); + Observable listQueryResultsForSubscriptionAsync(final String subscriptionId); /** * Queries policy events for the resources under the resource group. @@ -40,7 +40,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName); + Observable listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName); /** * Queries policy events for the resource. @@ -49,7 +49,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceAsync(String resourceId); + Observable listQueryResultsForResourceAsync(final String resourceId); /** * Queries policy events for the subscription level policy set definition. @@ -59,7 +59,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName); + Observable listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName); /** * Queries policy events for the subscription level policy definition. @@ -69,7 +69,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName); + Observable listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName); /** * Queries policy events for the subscription level policy assignment. @@ -79,7 +79,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName); + Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName); /** * Queries policy events for the resource group level policy assignment. @@ -90,7 +90,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName); + Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName); /** * Gets OData metadata XML document. diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyState.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyState.java new file mode 100644 index 0000000000000..e6a4a957c20f0 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyState.java @@ -0,0 +1,172 @@ +/** + * 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.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyStateInner; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing PolicyState. + */ +public interface PolicyState extends HasInner, HasManager { + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the complianceState value. + */ + String complianceState(); + + /** + * @return the effectiveParameters value. + */ + String effectiveParameters(); + + /** + * @return the isCompliant value. + */ + Boolean isCompliant(); + + /** + * @return the managementGroupIds value. + */ + String managementGroupIds(); + + /** + * @return the odatacontext value. + */ + String odatacontext(); + + /** + * @return the odataid value. + */ + String odataid(); + + /** + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * @return the policyAssignmentName value. + */ + String policyAssignmentName(); + + /** + * @return the policyAssignmentOwner value. + */ + String policyAssignmentOwner(); + + /** + * @return the policyAssignmentParameters value. + */ + String policyAssignmentParameters(); + + /** + * @return the policyAssignmentScope value. + */ + String policyAssignmentScope(); + + /** + * @return the policyDefinitionAction value. + */ + String policyDefinitionAction(); + + /** + * @return the policyDefinitionCategory value. + */ + String policyDefinitionCategory(); + + /** + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * @return the policyDefinitionName value. + */ + String policyDefinitionName(); + + /** + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * @return the policyEvaluationDetails value. + */ + PolicyEvaluationDetails policyEvaluationDetails(); + + /** + * @return the policySetDefinitionCategory value. + */ + String policySetDefinitionCategory(); + + /** + * @return the policySetDefinitionId value. + */ + String policySetDefinitionId(); + + /** + * @return the policySetDefinitionName value. + */ + String policySetDefinitionName(); + + /** + * @return the policySetDefinitionOwner value. + */ + String policySetDefinitionOwner(); + + /** + * @return the policySetDefinitionParameters value. + */ + String policySetDefinitionParameters(); + + /** + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the resourceLocation value. + */ + String resourceLocation(); + + /** + * @return the resourceTags value. + */ + String resourceTags(); + + /** + * @return the resourceType value. + */ + String resourceType(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the timestamp value. + */ + DateTime timestamp(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java index 80d9ee03c2339..71e252604210c 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java @@ -41,7 +41,7 @@ public interface PolicyStates { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId); + Observable listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId); /** * Summarizes policy states for the resources under the subscription. @@ -61,7 +61,7 @@ public interface PolicyStates { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName); + Observable listQueryResultsForResourceGroupAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName); /** * Summarizes policy states for the resources under the resource group. @@ -81,7 +81,7 @@ public interface PolicyStates { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId); + Observable listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId); /** * Summarizes policy states for the resource. @@ -101,7 +101,7 @@ public interface PolicyStates { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName); + Observable listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName); /** * Summarizes policy states for the subscription level policy set definition. @@ -122,7 +122,7 @@ public interface PolicyStates { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName); + Observable listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName); /** * Summarizes policy states for the subscription level policy definition. @@ -143,7 +143,7 @@ public interface PolicyStates { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName); + Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName); /** * Summarizes policy states for the subscription level policy assignment. @@ -165,7 +165,7 @@ public interface PolicyStates { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName); + Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName); /** * Summarizes policy states for the resource group level policy assignment. diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesQueryResults.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesQueryResults.java index 9c7248cbb336e..c4532e9954442 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesQueryResults.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesQueryResults.java @@ -29,6 +29,11 @@ public interface PolicyStatesQueryResults extends HasInner> listWithServiceResponseAsync() { - final String apiVersion = "2018-07-01-preview"; - return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -116,7 +118,7 @@ public Observable> call(Response listDelegate(Response response) throws QueryFailureException, IOException { + private ServiceResponse listDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(QueryFailureException.class) diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl1.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl1.java new file mode 100644 index 0000000000000..ca9e081b02d37 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * 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.policyinsights.v2018_07_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("@odata.nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventImpl.java new file mode 100644 index 0000000000000..239bc460873ae --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventImpl.java @@ -0,0 +1,178 @@ +/** + * 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.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvent; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; +import org.joda.time.DateTime; + +class PolicyEventImpl extends WrapperImpl implements PolicyEvent { + private final PolicyInsightsManager manager; + PolicyEventImpl(PolicyEventInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public String effectiveParameters() { + return this.inner().effectiveParameters(); + } + + @Override + public Boolean isCompliant() { + return this.inner().isCompliant(); + } + + @Override + public String managementGroupIds() { + return this.inner().managementGroupIds(); + } + + @Override + public String odatacontext() { + return this.inner().odatacontext(); + } + + @Override + public String odataid() { + return this.inner().odataid(); + } + + @Override + public String policyAssignmentId() { + return this.inner().policyAssignmentId(); + } + + @Override + public String policyAssignmentName() { + return this.inner().policyAssignmentName(); + } + + @Override + public String policyAssignmentOwner() { + return this.inner().policyAssignmentOwner(); + } + + @Override + public String policyAssignmentParameters() { + return this.inner().policyAssignmentParameters(); + } + + @Override + public String policyAssignmentScope() { + return this.inner().policyAssignmentScope(); + } + + @Override + public String policyDefinitionAction() { + return this.inner().policyDefinitionAction(); + } + + @Override + public String policyDefinitionCategory() { + return this.inner().policyDefinitionCategory(); + } + + @Override + public String policyDefinitionId() { + return this.inner().policyDefinitionId(); + } + + @Override + public String policyDefinitionName() { + return this.inner().policyDefinitionName(); + } + + @Override + public String policyDefinitionReferenceId() { + return this.inner().policyDefinitionReferenceId(); + } + + @Override + public String policySetDefinitionCategory() { + return this.inner().policySetDefinitionCategory(); + } + + @Override + public String policySetDefinitionId() { + return this.inner().policySetDefinitionId(); + } + + @Override + public String policySetDefinitionName() { + return this.inner().policySetDefinitionName(); + } + + @Override + public String policySetDefinitionOwner() { + return this.inner().policySetDefinitionOwner(); + } + + @Override + public String policySetDefinitionParameters() { + return this.inner().policySetDefinitionParameters(); + } + + @Override + public String principalOid() { + return this.inner().principalOid(); + } + + @Override + public String resourceGroup() { + return this.inner().resourceGroup(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public String resourceLocation() { + return this.inner().resourceLocation(); + } + + @Override + public String resourceTags() { + return this.inner().resourceTags(); + } + + @Override + public String resourceType() { + return this.inner().resourceType(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + + @Override + public DateTime timestamp() { + return this.inner().timestamp(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java index 1c884b5f26cfd..c1ccc4ab9df1f 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java @@ -13,7 +13,8 @@ import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents; import rx.functions.Func1; import rx.Observable; -import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEventsQueryResults; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvent; class PolicyEventsImpl extends WrapperImpl implements PolicyEvents { private final PolicyInsightsManager manager; @@ -28,97 +29,145 @@ public PolicyInsightsManager manager() { } @Override - public Observable listQueryResultsForManagementGroupAsync(String managementGroupName) { + public Observable listQueryResultsForManagementGroupAsync(final String managementGroupName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForManagementGroupAsync(managementGroupName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForSubscriptionAsync(String subscriptionId) { + public Observable listQueryResultsForSubscriptionAsync(final String subscriptionId) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForSubscriptionAsync(subscriptionId) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) { + public Observable listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForResourceGroupAsync(subscriptionId, resourceGroupName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForResourceAsync(String resourceId) { + public Observable listQueryResultsForResourceAsync(final String resourceId) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForResourceAsync(resourceId) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { + public Observable listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForPolicySetDefinitionAsync(subscriptionId, policySetDefinitionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { + public Observable listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForPolicyDefinitionAsync(subscriptionId, policyDefinitionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { + public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(subscriptionId, policyAssignmentName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(subscriptionId, resourceGroupName, policyAssignmentName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java index fa9b428e4eff7..949bc76c6640f 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java @@ -10,13 +10,18 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryFailureException; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryOptions; +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 com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import org.joda.time.DateTime; import retrofit2.http.GET; @@ -25,6 +30,7 @@ import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -91,6 +97,38 @@ interface PolicyEventsService { @GET("{scope}/providers/Microsoft.PolicyInsights/policyEvents/$metadata") Observable> getMetadata(@Path(value = "scope", encoded = true) String scope, @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.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForManagementGroupNext" }) + @GET + Observable> listQueryResultsForManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForSubscriptionNext" }) + @GET + Observable> listQueryResultsForSubscriptionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceGroupNext" }) + @GET + Observable> listQueryResultsForResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceNext" }) + @GET + Observable> listQueryResultsForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForPolicySetDefinitionNext" }) + @GET + Observable> listQueryResultsForPolicySetDefinitionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForPolicyDefinitionNext" }) + @GET + Observable> listQueryResultsForPolicyDefinitionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForSubscriptionLevelPolicyAssignmentNext" }) + @GET + Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceGroupLevelPolicyAssignmentNext" }) + @GET + Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -100,10 +138,16 @@ interface PolicyEventsService { * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName).toBlocking().single().body(); + public PagedList listQueryResultsForManagementGroup(final String managementGroupName) { + ServiceResponse> response = listQueryResultsForManagementGroupSinglePageAsync(managementGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -114,8 +158,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String m * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForManagementGroupAsync(String managementGroupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName), serviceCallback); + public ServiceFuture> listQueryResultsForManagementGroupAsync(final String managementGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupSinglePageAsync(managementGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -123,15 +175,37 @@ public ServiceFuture listQueryResultsForManagemen * * @param managementGroupName Management group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForManagementGroupAsync(String managementGroupName) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForManagementGroupAsync(final String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForManagementGroupWithServiceResponseAsync(final String managementGroupName) { + return listQueryResultsForManagementGroupSinglePageAsync(managementGroupName) + .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(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -139,15 +213,17 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForManagementGroupWithServiceResponseAsync(String managementGroupName) { + public Observable>> listQueryResultsForManagementGroupSinglePageAsync(final String managementGroupName) { if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -156,13 +232,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForManagementGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -178,10 +254,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName, QueryOptions queryOptions) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForManagementGroup(final String managementGroupName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -193,8 +275,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String m * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForManagementGroupAsync(final String managementGroupName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -203,15 +293,16 @@ public ServiceFuture listQueryResultsForManagemen * @param managementGroupName Management group name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForManagementGroupAsync(final String managementGroupName, final QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -220,16 +311,40 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForManagementGroupWithServiceResponseAsync(final String managementGroupName, final QueryOptions queryOptions) { + return listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, queryOptions) + .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(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + ServiceResponse> * @param managementGroupName Management group name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(String managementGroupName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForManagementGroupSinglePageAsync(final String managementGroupName, final QueryOptions queryOptions) { if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -258,13 +373,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForManagementGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -272,9 +387,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForManagementGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForManagementGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -286,10 +401,16 @@ private ServiceResponse listQueryResultsForManage * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + public PagedList listQueryResultsForSubscription(final String subscriptionId) { + ServiceResponse> response = listQueryResultsForSubscriptionSinglePageAsync(subscriptionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -300,8 +421,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subs * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionAsync(String subscriptionId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionAsync(final String subscriptionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionSinglePageAsync(subscriptionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -309,15 +438,37 @@ public ServiceFuture listQueryResultsForSubscript * * @param subscriptionId Microsoft Azure subscription ID. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForSubscriptionAsync(String subscriptionId) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionAsync(final String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForSubscriptionWithServiceResponseAsync(final String subscriptionId) { + return listQueryResultsForSubscriptionSinglePageAsync(subscriptionId) + .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(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -325,14 +476,16 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionWithServiceResponseAsync(String subscriptionId) { + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final String subscriptionId) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -341,13 +494,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForSubscription(policyEventsResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForSubscription(policyEventsResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -363,10 +516,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForSubscription(final String subscriptionId, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForSubscriptionSinglePageAsync(subscriptionId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -378,8 +537,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subs * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionAsync(final String subscriptionId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionSinglePageAsync(subscriptionId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -388,15 +555,16 @@ public ServiceFuture listQueryResultsForSubscript * @param subscriptionId Microsoft Azure subscription ID. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionAsync(final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -405,15 +573,39 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionWithServiceResponseAsync(final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionSinglePageAsync(subscriptionId, queryOptions) + .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(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(String subscriptionId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final String subscriptionId, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter 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."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -442,13 +634,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForSubscription(policyEventsResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForSubscription(policyEventsResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -456,9 +648,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForSubscriptionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForSubscriptionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -471,10 +663,16 @@ private ServiceResponse listQueryResultsForSubscr * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroup(final String subscriptionId, final String resourceGroupName) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -486,8 +684,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String sub * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -496,15 +702,38 @@ public ServiceFuture listQueryResultsForResourceG * @param subscriptionId Microsoft Azure subscription ID. * @param resourceGroupName Resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName) { + return listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -513,17 +742,19 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName) { + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final String subscriptionId, final String resourceGroupName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -532,13 +763,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -555,10 +786,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroup(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -571,8 +808,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String sub * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -582,15 +827,16 @@ public ServiceFuture listQueryResultsForResourceG * @param resourceGroupName Resource group name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -600,18 +846,43 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, queryOptions) + .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(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -640,13 +911,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -654,9 +925,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -668,10 +939,16 @@ private ServiceResponse listQueryResultsForResour * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId) { - return listQueryResultsForResourceWithServiceResponseAsync(resourceId).toBlocking().single().body(); + public PagedList listQueryResultsForResource(final String resourceId) { + ServiceResponse> response = listQueryResultsForResourceSinglePageAsync(resourceId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -682,8 +959,33 @@ public PolicyEventsQueryResultsInner listQueryResultsForResource(String resource * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceAsync(String resourceId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(resourceId), serviceCallback); + public ServiceFuture> listQueryResultsForResourceAsync(final String resourceId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceSinglePageAsync(resourceId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForResourceAsync(final String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -691,15 +993,20 @@ public ServiceFuture listQueryResultsForResourceA * * @param resourceId Resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceAsync(String resourceId) { - return listQueryResultsForResourceWithServiceResponseAsync(resourceId).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable>> listQueryResultsForResourceWithServiceResponseAsync(final String resourceId) { + return listQueryResultsForResourceSinglePageAsync(resourceId) + .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(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -707,14 +1014,16 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForResourceWithServiceResponseAsync(String resourceId) { + public Observable>> listQueryResultsForResourceSinglePageAsync(final String resourceId) { if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -723,13 +1032,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResource(policyEventsResource, resourceId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResource(policyEventsResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -745,10 +1054,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId, QueryOptions queryOptions) { - return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResource(final String resourceId, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceSinglePageAsync(resourceId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -760,8 +1075,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResource(String resource * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceAsync(String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceAsync(final String resourceId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceSinglePageAsync(resourceId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -770,15 +1093,16 @@ public ServiceFuture listQueryResultsForResourceA * @param resourceId Resource ID. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceAsync(String resourceId, QueryOptions queryOptions) { - return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceAsync(final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -787,15 +1111,39 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForResourceWithServiceResponseAsync(String resourceId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceWithServiceResponseAsync(final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceSinglePageAsync(resourceId, queryOptions) + .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(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource. + * + ServiceResponse> * @param resourceId Resource ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceSinglePageAsync(final String resourceId, final QueryOptions queryOptions) { if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -824,13 +1172,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResource(policyEventsResource, resourceId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResource(policyEventsResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -838,9 +1186,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -853,10 +1201,16 @@ private ServiceResponse listQueryResultsForResour * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).toBlocking().single().body(); + public PagedList listQueryResultsForPolicySetDefinition(final String subscriptionId, final String policySetDefinitionName) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -868,8 +1222,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(Stri * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); + public ServiceFuture> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -878,15 +1240,38 @@ public ServiceFuture listQueryResultsForPolicySet * @param subscriptionId Microsoft Azure subscription ID. * @param policySetDefinitionName Policy set definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(final String subscriptionId, final String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName) + .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(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -895,18 +1280,20 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName) { + public Observable>> listQueryResultsForPolicySetDefinitionSinglePageAsync(final String subscriptionId, final String policySetDefinitionName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -915,13 +1302,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForPolicySetDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForPolicySetDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -938,10 +1325,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForPolicySetDefinition(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -954,8 +1347,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(Stri * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -965,15 +1366,16 @@ public ServiceFuture listQueryResultsForPolicySet * @param policySetDefinitionName Policy set definition name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -983,19 +1385,44 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName, queryOptions) + .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(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policySetDefinitionName Policy set definition name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForPolicySetDefinitionSinglePageAsync(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1024,13 +1451,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForPolicySetDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForPolicySetDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1038,9 +1465,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1053,11 +1480,17 @@ private ServiceResponse listQueryResultsForPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).toBlocking().single().body(); - } + public PagedList listQueryResultsForPolicyDefinition(final String subscriptionId, final String policyDefinitionName) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } /** * Queries policy events for the subscription level policy definition. @@ -1068,8 +1501,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName), serviceCallback); + public ServiceFuture> listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1078,15 +1519,38 @@ public ServiceFuture listQueryResultsForPolicyDef * @param subscriptionId Microsoft Azure subscription ID. * @param policyDefinitionName Policy definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(final String subscriptionId, final String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName) + .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(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -1095,18 +1559,20 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { + public Observable>> listQueryResultsForPolicyDefinitionSinglePageAsync(final String subscriptionId, final String policyDefinitionName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1115,13 +1581,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1138,10 +1604,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForPolicyDefinition(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1154,8 +1626,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1165,15 +1645,16 @@ public ServiceFuture listQueryResultsForPolicyDef * @param policyDefinitionName Policy definition name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1183,19 +1664,44 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName, queryOptions) + .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(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policyDefinitionName Policy definition name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForPolicyDefinitionSinglePageAsync(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1224,13 +1730,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1238,9 +1744,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1253,10 +1759,16 @@ private ServiceResponse listQueryResultsForPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).toBlocking().single().body(); + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignment(final String subscriptionId, final String policyAssignmentName) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1268,8 +1780,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyA * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1278,15 +1798,38 @@ public ServiceFuture listQueryResultsForSubscript * @param subscriptionId Microsoft Azure subscription ID. * @param policyAssignmentName Policy assignment name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(final String subscriptionId, final String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName) + .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(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -1295,18 +1838,20 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName) { + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(final String subscriptionId, final String policyAssignmentName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1315,13 +1860,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1338,10 +1883,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignment(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1354,8 +1905,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyA * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1365,15 +1924,16 @@ public ServiceFuture listQueryResultsForSubscript * @param policyAssignmentName Policy assignment name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1383,19 +1943,44 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName, queryOptions) + .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(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policyAssignmentName Policy assignment name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1424,13 +2009,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1438,9 +2023,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1454,10 +2039,16 @@ private ServiceResponse listQueryResultsForSubscr * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignment(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1470,8 +2061,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1481,15 +2080,16 @@ public ServiceFuture listQueryResultsForResourceG * @param resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1499,9 +2099,32 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName) + .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(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } @@ -1511,9 +2134,11 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1522,13 +2147,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1546,10 +2171,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignment(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1563,8 +2194,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1575,15 +2214,16 @@ public ServiceFuture listQueryResultsForResourceG * @param policyAssignmentName Policy assignment name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1594,9 +2234,33 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions) + .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(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param policyAssignmentName Policy assignment name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } @@ -1606,10 +2270,12 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1638,13 +2304,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1652,9 +2318,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1711,8 +2377,10 @@ public Observable> getMetadataWithServiceResponseAsync(S if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } - final String apiVersion = "2018-04-04"; - return service.getMetadata(scope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getMetadata(scope, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1733,4 +2401,892 @@ private ServiceResponse getMetadataDelegate(Response respo .build(response); } + /** + * Queries policy events for the resources under the management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the resources under the management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForManagementGroupNextAsync(final String nextPageLink) { + return listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(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(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForManagementGroupNextSinglePageAsync(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.listQueryResultsForManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForManagementGroupNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForSubscriptionNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the resources under the 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> listQueryResultsForSubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resources under the 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<PolicyEventInner> object + */ + public Observable> listQueryResultsForSubscriptionNextAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the 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<PolicyEventInner> object + */ + public Observable>> listQueryResultsForSubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(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(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the 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<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForSubscriptionNextSinglePageAsync(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.listQueryResultsForSubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForSubscriptionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForResourceGroupNextAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(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(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupNextSinglePageAsync(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.listQueryResultsForResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForResourceGroupNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForResourceNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the resource. + * + * @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> listQueryResultsForResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resource. + * + * @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<PolicyEventInner> object + */ + public Observable> listQueryResultsForResourceNextAsync(final String nextPageLink) { + return listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resource. + * + * @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<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(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(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceNextSinglePageAsync(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.listQueryResultsForResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForResourceNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForPolicySetDefinitionNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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> listQueryResultsForPolicySetDefinitionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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<PolicyEventInner> object + */ + public Observable> listQueryResultsForPolicySetDefinitionNextAsync(final String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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<PolicyEventInner> object + */ + public Observable>> listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(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(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(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.listQueryResultsForPolicySetDefinitionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForPolicySetDefinitionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForPolicySetDefinitionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForPolicyDefinitionNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @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> listQueryResultsForPolicyDefinitionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @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<PolicyEventInner> object + */ + public Observable> listQueryResultsForPolicyDefinitionNextAsync(final String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @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<PolicyEventInner> object + */ + public Observable>> listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(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(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForPolicyDefinitionNextSinglePageAsync(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.listQueryResultsForPolicyDefinitionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForPolicyDefinitionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForPolicyDefinitionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignmentNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @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> listQueryResultsForSubscriptionLevelPolicyAssignmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @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<PolicyEventInner> object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentNextAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @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<PolicyEventInner> object + */ + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(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(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(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.listQueryResultsForSubscriptionLevelPolicyAssignmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignmentNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @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> listQueryResultsForResourceGroupLevelPolicyAssignmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @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<PolicyEventInner> object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentNextAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @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<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(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(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(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.listQueryResultsForResourceGroupLevelPolicyAssignmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForResourceGroupLevelPolicyAssignmentNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + } diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java index d8a9470043a2b..537ec056035bd 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java @@ -28,6 +28,18 @@ public AzureClient getAzureClient() { return this.azureClient; } + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + /** The preferred language for the response. */ private String acceptLanguage; @@ -193,6 +205,7 @@ public PolicyInsightsClientImpl(RestClient restClient) { } protected void initialize() { + this.apiVersion = "2018-07-01-preview"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -211,6 +224,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "PolicyInsightsClient", "2018-07-01-preiew"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "PolicyInsightsClient", "2018-07-01-preview"); } } diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateImpl.java new file mode 100644 index 0000000000000..8f4bedda909d8 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateImpl.java @@ -0,0 +1,179 @@ +/** + * 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.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyState; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvaluationDetails; +import org.joda.time.DateTime; + +class PolicyStateImpl extends WrapperImpl implements PolicyState { + private final PolicyInsightsManager manager; + PolicyStateImpl(PolicyStateInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public String complianceState() { + return this.inner().complianceState(); + } + + @Override + public String effectiveParameters() { + return this.inner().effectiveParameters(); + } + + @Override + public Boolean isCompliant() { + return this.inner().isCompliant(); + } + + @Override + public String managementGroupIds() { + return this.inner().managementGroupIds(); + } + + @Override + public String odatacontext() { + return this.inner().odatacontext(); + } + + @Override + public String odataid() { + return this.inner().odataid(); + } + + @Override + public String policyAssignmentId() { + return this.inner().policyAssignmentId(); + } + + @Override + public String policyAssignmentName() { + return this.inner().policyAssignmentName(); + } + + @Override + public String policyAssignmentOwner() { + return this.inner().policyAssignmentOwner(); + } + + @Override + public String policyAssignmentParameters() { + return this.inner().policyAssignmentParameters(); + } + + @Override + public String policyAssignmentScope() { + return this.inner().policyAssignmentScope(); + } + + @Override + public String policyDefinitionAction() { + return this.inner().policyDefinitionAction(); + } + + @Override + public String policyDefinitionCategory() { + return this.inner().policyDefinitionCategory(); + } + + @Override + public String policyDefinitionId() { + return this.inner().policyDefinitionId(); + } + + @Override + public String policyDefinitionName() { + return this.inner().policyDefinitionName(); + } + + @Override + public String policyDefinitionReferenceId() { + return this.inner().policyDefinitionReferenceId(); + } + + @Override + public PolicyEvaluationDetails policyEvaluationDetails() { + return this.inner().policyEvaluationDetails(); + } + + @Override + public String policySetDefinitionCategory() { + return this.inner().policySetDefinitionCategory(); + } + + @Override + public String policySetDefinitionId() { + return this.inner().policySetDefinitionId(); + } + + @Override + public String policySetDefinitionName() { + return this.inner().policySetDefinitionName(); + } + + @Override + public String policySetDefinitionOwner() { + return this.inner().policySetDefinitionOwner(); + } + + @Override + public String policySetDefinitionParameters() { + return this.inner().policySetDefinitionParameters(); + } + + @Override + public String resourceGroup() { + return this.inner().resourceGroup(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public String resourceLocation() { + return this.inner().resourceLocation(); + } + + @Override + public String resourceTags() { + return this.inner().resourceTags(); + } + + @Override + public String resourceType() { + return this.inner().resourceType(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public DateTime timestamp() { + return this.inner().timestamp(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java index 2b650a74467a5..50b2584e4af47 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java @@ -13,8 +13,10 @@ import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.Page; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesQueryResults; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.SummarizeResults; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyState; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesResource; class PolicyStatesImpl extends WrapperImpl implements PolicyStates { @@ -54,13 +56,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId) { + public Observable listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForSubscriptionAsync(policyStatesResource, subscriptionId) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -78,13 +86,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + public Observable listQueryResultsForResourceGroupAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForResourceGroupAsync(policyStatesResource, subscriptionId, resourceGroupName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -102,13 +116,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId) { + public Observable listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForResourceAsync(policyStatesResource, resourceId) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -126,13 +146,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + public Observable listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForPolicySetDefinitionAsync(policyStatesResource, subscriptionId, policySetDefinitionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -150,13 +176,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + public Observable listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForPolicyDefinitionAsync(policyStatesResource, subscriptionId, policyDefinitionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -174,13 +206,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(policyStatesResource, subscriptionId, policyAssignmentName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -198,13 +236,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { + public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java index f52804758294c..5e6d01cc14c62 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java @@ -10,14 +10,19 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesResource; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryFailureException; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryOptions; +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 com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import org.joda.time.DateTime; import retrofit2.http.GET; @@ -26,6 +31,7 @@ import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -124,6 +130,34 @@ interface PolicyStatesService { @GET("{scope}/providers/Microsoft.PolicyInsights/policyStates/$metadata") Observable> getMetadata(@Path(value = "scope", encoded = true) String scope, @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.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForSubscriptionNext" }) + @GET + Observable> listQueryResultsForSubscriptionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResourceGroupNext" }) + @GET + Observable> listQueryResultsForResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResourceNext" }) + @GET + Observable> listQueryResultsForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForPolicySetDefinitionNext" }) + @GET + Observable> listQueryResultsForPolicySetDefinitionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForPolicyDefinitionNext" }) + @GET + Observable> listQueryResultsForPolicyDefinitionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForSubscriptionLevelPolicyAssignmentNext" }) + @GET + Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResourceGroupLevelPolicyAssignmentNext" }) + @GET + Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -185,8 +219,10 @@ public Observable> listQueryResul if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -195,7 +231,7 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -272,9 +308,11 @@ public Observable> listQueryResul if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -303,7 +341,7 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -376,15 +414,17 @@ public Observable> summarizeForManagement if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -454,10 +494,12 @@ public Observable> summarizeForManagement if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -474,7 +516,7 @@ public Observable> summarizeForManagement if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -503,10 +545,16 @@ private ServiceResponse summarizeForManagementGroupDelega * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId).toBlocking().single().body(); + public PagedList listQueryResultsForSubscription(final PolicyStatesResource policyStatesResource, final String subscriptionId) { + ServiceResponse> response = listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -518,8 +566,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyState * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -528,15 +584,16 @@ public ServiceFuture listQueryResultsForSubscript * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' * @param subscriptionId Microsoft Azure subscription ID. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -545,16 +602,40 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId) { + return listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId) + .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(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId) { + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -563,13 +644,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -586,10 +667,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForSubscription(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -602,8 +689,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyState * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -613,15 +708,16 @@ public ServiceFuture listQueryResultsForSubscript * @param subscriptionId Microsoft Azure subscription ID. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -631,17 +727,42 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId, queryOptions) + .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(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the subscription. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } if (subscriptionId == null) { throw new IllegalArgumentException("Parameter 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."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -670,13 +791,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -684,9 +805,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForSubscriptionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForSubscriptionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -743,14 +864,16 @@ public Observable> summarizeForSubscripti if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -820,9 +943,11 @@ public Observable> summarizeForSubscripti if (subscriptionId == null) { throw new IllegalArgumentException("Parameter 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."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -839,7 +964,7 @@ public Observable> summarizeForSubscripti if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -869,10 +994,16 @@ private ServiceResponse summarizeForSubscriptionDelegate( * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroup(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -885,8 +1016,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForResourceGroup(PolicyStat * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -896,15 +1035,16 @@ public ServiceFuture listQueryResultsForResourceG * @param subscriptionId Microsoft Azure subscription ID. * @param resourceGroupName Resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -914,9 +1054,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceGroupWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName) { + return listQueryResultsForResourceGroupSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -926,7 +1089,9 @@ public Observable> listQueryResul if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -935,13 +1100,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -959,10 +1124,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroup(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -976,8 +1147,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForResourceGroup(PolicyStat * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -988,15 +1167,16 @@ public ServiceFuture listQueryResultsForResourceG * @param resourceGroupName Resource group name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1007,9 +1187,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceGroupWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions) + .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(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the resource group. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -1019,8 +1223,10 @@ public Observable> listQueryResul if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1049,13 +1255,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1063,9 +1269,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1129,14 +1335,16 @@ public Observable> summarizeForResourceGr if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1213,9 +1421,11 @@ public Observable> summarizeForResourceGr if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1232,7 +1442,7 @@ public Observable> summarizeForResourceGr if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1261,10 +1471,16 @@ private ServiceResponse summarizeForResourceGroupDelegate * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForResource(PolicyStatesResource policyStatesResource, String resourceId) { - return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId).toBlocking().single().body(); + public PagedList listQueryResultsForResource(final PolicyStatesResource policyStatesResource, final String resourceId) { + ServiceResponse> response = listQueryResultsForResourceSinglePageAsync(policyStatesResource, resourceId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1276,8 +1492,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForResource(PolicyStatesRes * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId), serviceCallback); + public ServiceFuture> listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceSinglePageAsync(policyStatesResource, resourceId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1286,15 +1510,16 @@ public ServiceFuture listQueryResultsForResourceA * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' * @param resourceId Resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId) { - return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1303,16 +1528,40 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String resourceId) { + return listQueryResultsForResourceSinglePageAsync(policyStatesResource, resourceId) + .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(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId) { + public Observable>> listQueryResultsForResourceSinglePageAsync(final PolicyStatesResource policyStatesResource, final String resourceId) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1322,13 +1571,13 @@ public Observable> listQueryResul String filter = null; String apply = null; String expand = null; - return service.listQueryResultsForResource(policyStatesResource, resourceId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, expand, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResource(policyStatesResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, expand, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1345,10 +1594,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForResource(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { - return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResource(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceSinglePageAsync(policyStatesResource, resourceId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1361,8 +1616,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForResource(PolicyStatesRes * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceSinglePageAsync(policyStatesResource, resourceId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1372,15 +1635,16 @@ public ServiceFuture listQueryResultsForResourceA * @param resourceId Resource ID. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { - return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1390,17 +1654,42 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceSinglePageAsync(policyStatesResource, resourceId, queryOptions) + .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(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resource. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param resourceId Resource ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceSinglePageAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1433,13 +1722,13 @@ public Observable> listQueryResul if (queryOptions != null) { expand = queryOptions.expand(); } - return service.listQueryResultsForResource(policyStatesResource, resourceId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, expand, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResource(policyStatesResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, expand, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1447,9 +1736,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1506,14 +1795,16 @@ public Observable> summarizeForResourceWi if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForResource(policyStatesSummaryResource, resourceId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResource(policyStatesSummaryResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1583,9 +1874,11 @@ public Observable> summarizeForResourceWi if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1602,7 +1895,7 @@ public Observable> summarizeForResourceWi if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForResource(policyStatesSummaryResource, resourceId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResource(policyStatesSummaryResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1632,10 +1925,16 @@ private ServiceResponse summarizeForResourceDelegate(Resp * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForPolicySetDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName).toBlocking().single().body(); + public PagedList listQueryResultsForPolicySetDefinition(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policySetDefinitionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1648,8 +1947,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForPolicySetDefinition(Poli * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName), serviceCallback); + public ServiceFuture> listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policySetDefinitionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1659,15 +1966,16 @@ public ServiceFuture listQueryResultsForPolicySet * @param subscriptionId Microsoft Azure subscription ID. * @param policySetDefinitionName Policy set definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1677,9 +1985,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policySetDefinitionName) + .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(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + public Observable>> listQueryResultsForPolicySetDefinitionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -1689,8 +2020,10 @@ public Observable> listQueryResul if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1699,13 +2032,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1723,10 +2056,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForPolicySetDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForPolicySetDefinition(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1740,8 +2079,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForPolicySetDefinition(Poli * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1752,17 +2099,18 @@ public ServiceFuture listQueryResultsForPolicySet * @param policySetDefinitionName Policy set definition name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); - } - + public Observable> listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + /** * Queries policy states for the subscription level policy set definition. * @@ -1771,9 +2119,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions) + .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(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policySetDefinitionName Policy set definition name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForPolicySetDefinitionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -1783,9 +2155,11 @@ public Observable> listQueryResul if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1814,13 +2188,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1828,9 +2202,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1894,15 +2268,17 @@ public Observable> summarizeForPolicySetD if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1979,10 +2355,12 @@ public Observable> summarizeForPolicySetD if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1999,7 +2377,7 @@ public Observable> summarizeForPolicySetD if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2029,10 +2407,16 @@ private ServiceResponse summarizeForPolicySetDefinitionDe * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForPolicyDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName).toBlocking().single().body(); + public PagedList listQueryResultsForPolicyDefinition(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policyDefinitionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -2045,8 +2429,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForPolicyDefinition(PolicyS * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName), serviceCallback); + public ServiceFuture> listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policyDefinitionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -2056,15 +2448,16 @@ public ServiceFuture listQueryResultsForPolicyDef * @param subscriptionId Microsoft Azure subscription ID. * @param policyDefinitionName Policy definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -2074,9 +2467,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policyDefinitionName) + .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(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + public Observable>> listQueryResultsForPolicyDefinitionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2086,8 +2502,10 @@ public Observable> listQueryResul if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -2096,13 +2514,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2120,10 +2538,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForPolicyDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForPolicyDefinition(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -2137,8 +2561,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForPolicyDefinition(PolicyS * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -2149,15 +2581,16 @@ public ServiceFuture listQueryResultsForPolicyDef * @param policyDefinitionName Policy definition name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -2168,9 +2601,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions) + .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(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy definition. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policyDefinitionName Policy definition name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForPolicyDefinitionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2180,9 +2637,11 @@ public Observable> listQueryResul if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2211,13 +2670,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2225,9 +2684,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -2291,15 +2750,17 @@ public Observable> summarizeForPolicyDefi if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2376,10 +2837,12 @@ public Observable> summarizeForPolicyDefi if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2396,7 +2859,7 @@ public Observable> summarizeForPolicyDefi if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2426,10 +2889,16 @@ private ServiceResponse summarizeForPolicyDefinitionDeleg * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName).toBlocking().single().body(); + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignment(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, policyAssignmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -2442,8 +2911,35 @@ public PolicyStatesQueryResultsInner listQueryResultsForSubscriptionLevelPolicyA * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyStateInner> object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -2453,15 +2949,20 @@ public ServiceFuture listQueryResultsForSubscript * @param subscriptionId Microsoft Azure subscription ID. * @param policyAssignmentName Policy assignment name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, policyAssignmentName) + .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(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -2471,9 +2972,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2483,8 +2984,10 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -2493,13 +2996,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2517,10 +3020,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignment(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -2534,8 +3043,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForSubscriptionLevelPolicyA * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -2546,15 +3063,16 @@ public ServiceFuture listQueryResultsForSubscript * @param policyAssignmentName Policy assignment name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -2565,9 +3083,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions) + .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(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policyAssignmentName Policy assignment name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2577,9 +3119,11 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2608,13 +3152,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2622,9 +3166,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -2688,15 +3232,17 @@ public Observable> summarizeForSubscripti if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2773,10 +3319,12 @@ public Observable> summarizeForSubscripti if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2793,7 +3341,7 @@ public Observable> summarizeForSubscripti if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2824,10 +3372,16 @@ private ServiceResponse summarizeForSubscriptionLevelPoli * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignment(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -2841,8 +3395,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -2853,15 +3415,16 @@ public ServiceFuture listQueryResultsForResourceG * @param resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -2872,9 +3435,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName) + .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(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2887,8 +3474,10 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -2897,13 +3486,13 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2922,10 +3511,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyStatesQueryResultsInner object if successful. + * @return the PagedList<PolicyStateInner> object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignment(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -2940,8 +3535,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -2953,15 +3556,16 @@ public ServiceFuture listQueryResultsForResourceG * @param policyAssignmentName Policy assignment name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -2973,9 +3577,34 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions) + .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(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param policyAssignmentName Policy assignment name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2988,9 +3617,11 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -3019,13 +3650,13 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -3033,9 +3664,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -3106,15 +3737,17 @@ public Observable> summarizeForResourceGr if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3198,10 +3831,12 @@ public Observable> summarizeForResourceGr if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -3218,7 +3853,7 @@ public Observable> summarizeForResourceGr if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3291,8 +3926,10 @@ public Observable> getMetadataWithServiceResponseAsync(S if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.getMetadata(scope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getMetadata(scope, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3313,4 +3950,781 @@ private ServiceResponse getMetadataDelegate(Response respo .build(response); } + /** + * Queries policy states for the resources under the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyStateInner> object if successful. + */ + public PagedList listQueryResultsForSubscriptionNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy states for the resources under the 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> listQueryResultsForSubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the resources under the 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<PolicyStateInner> object + */ + public Observable> listQueryResultsForSubscriptionNextAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy states for the resources under the 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<PolicyStateInner> object + */ + public Observable>> listQueryResultsForSubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(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(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the 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<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForSubscriptionNextSinglePageAsync(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.listQueryResultsForSubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForSubscriptionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyStateInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyStateInner> object + */ + public Observable> listQueryResultsForResourceGroupNextAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyStateInner> object + */ + public Observable>> listQueryResultsForResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(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(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupNextSinglePageAsync(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.listQueryResultsForResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForResourceGroupNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy states for the resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyStateInner> object if successful. + */ + public PagedList listQueryResultsForResourceNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy states for the resource. + * + * @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> listQueryResultsForResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the resource. + * + * @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<PolicyStateInner> object + */ + public Observable> listQueryResultsForResourceNextAsync(final String nextPageLink) { + return listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy states for the resource. + * + * @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<PolicyStateInner> object + */ + public Observable>> listQueryResultsForResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(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(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceNextSinglePageAsync(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.listQueryResultsForResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForResourceNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyStateInner> object if successful. + */ + public PagedList listQueryResultsForPolicySetDefinitionNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @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> listQueryResultsForPolicySetDefinitionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @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<PolicyStateInner> object + */ + public Observable> listQueryResultsForPolicySetDefinitionNextAsync(final String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @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<PolicyStateInner> object + */ + public Observable>> listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(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(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(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.listQueryResultsForPolicySetDefinitionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForPolicySetDefinitionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForPolicySetDefinitionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyStateInner> object if successful. + */ + public PagedList listQueryResultsForPolicyDefinitionNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @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> listQueryResultsForPolicyDefinitionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @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<PolicyStateInner> object + */ + public Observable> listQueryResultsForPolicyDefinitionNextAsync(final String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @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<PolicyStateInner> object + */ + public Observable>> listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(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(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy definition. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForPolicyDefinitionNextSinglePageAsync(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.listQueryResultsForPolicyDefinitionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForPolicyDefinitionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForPolicyDefinitionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyStateInner> object if successful. + */ + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignmentNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @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> listQueryResultsForSubscriptionLevelPolicyAssignmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @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<PolicyStateInner> object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentNextAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @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<PolicyStateInner> object + */ + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(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(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(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.listQueryResultsForSubscriptionLevelPolicyAssignmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException 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<PolicyStateInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignmentNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @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> listQueryResultsForResourceGroupLevelPolicyAssignmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @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<PolicyStateInner> object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentNextAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @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<PolicyStateInner> object + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(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(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(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.listQueryResultsForResourceGroupLevelPolicyAssignmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForResourceGroupLevelPolicyAssignmentNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + } diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsImpl.java index aa6ffc9640ba2..a7113080953a5 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsImpl.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsImpl.java @@ -34,6 +34,11 @@ public Integer odatacount() { return this.inner().odatacount(); } + @Override + public String odatanextLink() { + return this.inner().odatanextLink(); + } + @Override public List value() { return this.inner().value(); diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsInner.java index 10193a88fb1df..ba327a4dde151 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsInner.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsInner.java @@ -35,6 +35,12 @@ public class PolicyStatesQueryResultsInner { @JsonProperty(value = "value") private List value; + /** + * Odata next link, used to get the next set of records. + */ + @JsonProperty(value = "@odata\\.nextLink") + private String odatanextLink; + /** * Get oData context string; used by OData clients to resolve type information based on metadata. * @@ -95,4 +101,24 @@ public PolicyStatesQueryResultsInner withValue(List value) { return this; } + /** + * Get odata next link, used to get the next set of records. + * + * @return the odatanextLink value + */ + public String odatanextLink() { + return this.odatanextLink; + } + + /** + * Set odata next link, used to get the next set of records. + * + * @param odatanextLink the odatanextLink value to set + * @return the PolicyStatesQueryResultsInner object itself. + */ + public PolicyStatesQueryResultsInner withOdatanextLink(String odatanextLink) { + this.odatanextLink = odatanextLink; + return this; + } + } diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java index fa1354dda1796..81aa98c40855e 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java @@ -181,13 +181,15 @@ public Observable>> listQueryRe if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -294,10 +296,12 @@ public Observable>> listQueryRe if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String managementGroupsNamespace = "Microsoft.Management"; final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -306,7 +310,7 @@ public Observable>> listQueryRe if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -415,12 +419,14 @@ public Observable>> listQueryRe if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -527,9 +533,11 @@ public Observable>> listQueryRe if (subscriptionId == null) { throw new IllegalArgumentException("Parameter 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."); + } Validator.validate(queryOptions); final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -538,7 +546,7 @@ public Observable>> listQueryRe if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -655,12 +663,14 @@ public Observable>> listQueryRe if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -775,9 +785,11 @@ public Observable>> listQueryRe if (subscriptionId == null) { throw new IllegalArgumentException("Parameter 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."); + } Validator.validate(queryOptions); final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -786,7 +798,7 @@ public Observable>> listQueryRe if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -895,12 +907,14 @@ public Observable>> listQueryRe if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1007,9 +1021,11 @@ public Observable>> listQueryRe if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1018,7 +1034,7 @@ public Observable>> listQueryRe if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java index 12edd06ce8509..616969ac5ecc8 100644 --- a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java @@ -289,11 +289,13 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; - return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -408,14 +410,16 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); } - return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -495,9 +499,11 @@ public Observable> cancelAtManagementGroupWith if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; - return service.cancelAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.cancelAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -606,12 +612,14 @@ public Observable>> listForManagementGrou if (managementGroupId == null) { throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -718,9 +726,11 @@ public Observable>> listForManagementGrou if (managementGroupId == null) { throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -729,7 +739,7 @@ public Observable>> listForManagementGrou if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -813,13 +823,15 @@ public Observable> createOrUpdateAtManagementG if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; - return service.createOrUpdateAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -900,9 +912,11 @@ public Observable> getAtManagementGroupWithSer if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; - return service.getAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.getAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -982,9 +996,11 @@ public Observable> deleteAtManagementGroupWith if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; - return service.deleteAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.deleteAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1102,10 +1118,12 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; - return service.listDeploymentsAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1220,13 +1238,15 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); } - return service.listDeploymentsAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1306,8 +1326,10 @@ public Observable> cancelAtSubscriptionWithSer if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.cancelAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancelAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1416,11 +1438,13 @@ public Observable>> listSinglePageAsync(f if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.list(subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.list(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1527,8 +1551,10 @@ public Observable>> listSinglePageAsync(f if (subscriptionId == null) { throw new IllegalArgumentException("Parameter 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."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1537,7 +1563,7 @@ public Observable>> listSinglePageAsync(f if (queryOptions != null) { filter = queryOptions.filter(); } - return service.list(subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.list(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1621,12 +1647,14 @@ public Observable> createOrUpdateAtSubscriptio if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - final String apiVersion = "2018-07-01-preview"; - return service.createOrUpdateAtSubscription(subscriptionId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1707,8 +1735,10 @@ public Observable> getAtSubscriptionWithServic if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.getAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1788,8 +1818,10 @@ public Observable> deleteAtSubscriptionWithSer if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.deleteAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1915,10 +1947,12 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; - return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2041,13 +2075,15 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); } - return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2134,8 +2170,10 @@ public Observable> cancelAtResourceGroupWithSe if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.cancelAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancelAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2252,11 +2290,13 @@ public Observable>> listByResourceGroupSi if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listByResourceGroup(subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listByResourceGroup(subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2371,8 +2411,10 @@ public Observable>> listByResourceGroupSi if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2381,7 +2423,7 @@ public Observable>> listByResourceGroupSi if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listByResourceGroup(subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listByResourceGroup(subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2472,12 +2514,14 @@ public Observable> createOrUpdateAtResourceGro if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - final String apiVersion = "2018-07-01-preview"; - return service.createOrUpdateAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2565,8 +2609,10 @@ public Observable> getByResourceGroupWithServi if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.getByResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2653,8 +2699,10 @@ public Observable> deleteAtResourceGroupWithSe if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.deleteAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2772,10 +2820,12 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; - return service.listDeploymentsAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2890,13 +2940,15 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); } - return service.listDeploymentsAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2976,8 +3028,10 @@ public Observable> cancelAtResourceWithService if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.cancelAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancelAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3086,11 +3140,13 @@ public Observable>> listForResourceSingle if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listForResource(resourceId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listForResource(resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -3197,8 +3253,10 @@ public Observable>> listForResourceSingle if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -3207,7 +3265,7 @@ public Observable>> listForResourceSingle if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listForResource(resourceId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listForResource(resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -3291,12 +3349,14 @@ public Observable> createOrUpdateAtResourceWit if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - final String apiVersion = "2018-07-01-preview"; - return service.createOrUpdateAtResource(resourceId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateAtResource(resourceId, remediationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3377,8 +3437,10 @@ public Observable> getAtResourceWithServiceRes if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.getAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3458,8 +3520,10 @@ public Observable> deleteAtResourceWithService if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.deleteAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) {