diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml b/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml index 99d6e8bbf63e..7013f5301146 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.2.0 + 1.1.0 ../../../pom.management.xml azure-mgmt-policyinsights @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyState.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyState.java new file mode 100644 index 000000000000..e6a4a957c20f --- /dev/null +++ b/sdk/policyinsights/mgmt-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/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java index 80d9ee03c233..5a9063142f97 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java @@ -22,7 +22,7 @@ public interface PolicyStates { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName); + Observable listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName); /** * Summarizes policy states for the resources under the management group. @@ -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/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java index 3e892d592505..49d3df8de9af 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java @@ -75,7 +75,7 @@ public interface Remediation extends HasInner, Indexable, Upda /** * The entirety of the Remediation definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagementGroup, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithMicrosoft.PolicyInsight, DefinitionStages.WithCreate { } /** @@ -85,19 +85,19 @@ interface DefinitionStages { /** * The first stage of a Remediation definition. */ - interface Blank extends WithManagementGroup { + interface Blank extends WithMicrosoft.PolicyInsight { } /** * The stage of the remediation definition allowing to specify Microsoft.PolicyInsight. */ - interface WithManagementGroup { + interface WithMicrosoft.PolicyInsight { /** * Specifies managementGroupId. * @param managementGroupId Management group ID * @return the next definition stage */ - WithCreate withManagementGroupId(String managementGroupId); + WithCreate withExistingMicrosoft.PolicyInsight(String managementGroupId); } /** diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl1.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl1.java new file mode 100644 index 000000000000..ca9e081b02d3 --- /dev/null +++ b/sdk/policyinsights/mgmt-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/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateImpl.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateImpl.java new file mode 100644 index 000000000000..8f4bedda909d --- /dev/null +++ b/sdk/policyinsights/mgmt-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/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java index 2b650a74467a..5f3e29d72fe1 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java @@ -13,7 +13,8 @@ import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates; import rx.functions.Func1; import rx.Observable; -import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesQueryResults; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyState; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.SummarizeResults; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesResource; @@ -30,13 +31,19 @@ public PolicyInsightsManager manager() { } @Override - public Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName) { + public Observable listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForManagementGroupAsync(policyStatesResource, managementGroupName) - .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()); } }); } @@ -54,13 +61,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 Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -78,13 +91,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 +121,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 Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -126,13 +151,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 +181,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 Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -174,13 +211,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 +241,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 Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java index f52804758294..8103f438d1f6 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java +++ b/sdk/policyinsights/mgmt-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,38 @@ 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 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.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); + } /** @@ -134,10 +172,16 @@ interface PolicyStatesService { * @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 listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).toBlocking().single().body(); + public PagedList listQueryResultsForManagementGroup(final PolicyStatesResource policyStatesResource, final String managementGroupName) { + ServiceResponse> response = listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -149,8 +193,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForManagementGroup(PolicySt * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName), serviceCallback); + public ServiceFuture> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -159,15 +211,38 @@ public ServiceFuture listQueryResultsForManagemen * @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 managementGroupName Management 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 listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy states for the resources under the management 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 managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyStateInner> object + */ + public Observable>> listQueryResultsForManagementGroupWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) { + return listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, 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)); + } + }); } /** @@ -176,9 +251,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName) { + public Observable>> listQueryResultsForManagementGroupSinglePageAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -196,12 +271,12 @@ public Observable> listQueryResul 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()) - .flatMap(new Func1, Observable>>() { + .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); } @@ -218,10 +293,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 listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForManagementGroup(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -234,8 +315,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForManagementGroup(PolicySt * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -245,15 +334,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 PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -263,9 +353,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForManagementGroupWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) { + return listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, 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 states for the resources under the management 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 managementGroupName Management 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> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForManagementGroupSinglePageAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -304,12 +417,12 @@ public Observable> listQueryResul apply = queryOptions.apply(); } return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .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); } @@ -317,9 +430,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); } @@ -503,10 +616,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 +637,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 +655,38 @@ 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(); + } + }); + } + + /** + * 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 observable to the PagedList<PolicyStateInner> object + */ + public Observable>> 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)); + } + }); } /** @@ -545,9 +695,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> 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."); } @@ -564,12 +714,12 @@ public Observable> listQueryResul 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>>() { + .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 +736,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 +758,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 +777,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,9 +796,32 @@ 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."); } @@ -671,12 +859,12 @@ public Observable> listQueryResul 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>>() { + .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 +872,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); } @@ -869,10 +1057,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 +1079,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 +1098,39 @@ 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(); + } + }); + } + + /** + * 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 observable to the PagedList<PolicyStateInner> object + */ + public Observable>> 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)); + } + }); } /** @@ -914,9 +1140,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> 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."); } @@ -936,12 +1162,12 @@ public Observable> listQueryResul 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>>() { + .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 +1185,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 +1208,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 +1228,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 +1248,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."); } @@ -1050,12 +1315,12 @@ public Observable> listQueryResul 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>>() { + .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 +1328,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); } @@ -1261,10 +1526,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 +1547,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 +1565,38 @@ 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(); + } + }); + } + + /** + * 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 observable to the PagedList<PolicyStateInner> object + */ + public Observable>> 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)); + } + }); } /** @@ -1303,9 +1605,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> 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."); } @@ -1323,12 +1625,12 @@ public Observable> listQueryResul 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>>() { + .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 +1647,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 +1669,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 +1688,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,9 +1707,32 @@ 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."); } @@ -1434,12 +1774,12 @@ public Observable> listQueryResul 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>>() { + .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 +1787,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); } @@ -1632,10 +1972,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 +1994,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 +2013,39 @@ 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(); + } + }); + } + + /** + * 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 observable to the PagedList<PolicyStateInner> object + */ + public Observable>> 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)); + } + }); } /** @@ -1677,9 +2055,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> 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."); } @@ -1700,12 +2078,12 @@ public Observable> listQueryResul 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>>() { + .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 +2101,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 +2124,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,15 +2144,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 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(); + } + }); } /** @@ -1771,9 +2164,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."); } @@ -1815,12 +2232,12 @@ public Observable> listQueryResul 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>>() { + .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 +2245,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); } @@ -2029,10 +2446,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 +2468,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 +2487,39 @@ 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(); + } + }); + } + + /** + * 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 observable to the PagedList<PolicyStateInner> object + */ + public Observable>> 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)); + } + }); } /** @@ -2074,9 +2529,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> 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."); } @@ -2097,12 +2552,12 @@ public Observable> listQueryResul 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>>() { + .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 +2575,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 +2598,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 +2618,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 +2638,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."); } @@ -2212,12 +2706,12 @@ public Observable> listQueryResul 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>>() { + .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 +2719,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); } @@ -2426,10 +2920,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 +2942,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, 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); } /** @@ -2453,15 +2961,39 @@ 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> 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(); + } + }); + } + + /** + * 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>> 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 +3003,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."); } @@ -2494,12 +3026,12 @@ public Observable> listQueryResul 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>>() { + .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 +3049,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 +3072,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 +3092,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 +3112,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + public Observable>> 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>> 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."); } @@ -2609,12 +3180,12 @@ public Observable> listQueryResul 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>>() { + .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 +3193,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); } @@ -2824,10 +3395,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 +3418,36 @@ 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); + } + + /** + * 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 observable to the PagedList<PolicyStateInner> object + */ + 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(); + } + }); } /** @@ -2853,15 +3458,20 @@ 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>> 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)); + } + }); } /** @@ -2872,9 +3482,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> 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."); } @@ -2898,12 +3508,12 @@ public Observable> listQueryResul 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>>() { + .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 +3532,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 +3556,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 +3577,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 +3598,34 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> 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> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + 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."); } @@ -3020,12 +3670,12 @@ public Observable> listQueryResul 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>>() { + .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 +3683,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); } @@ -3313,4 +3963,892 @@ private ServiceResponse getMetadataDelegate(Response respo .build(response); } + /** + * Queries policy states 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<PolicyStateInner> 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 states 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 states 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<PolicyStateInner> 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 states 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<PolicyStateInner> 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 states 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<PolicyStateInner> 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 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/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationImpl.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationImpl.java index ef922cadedfe..bb0988bbdd83 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationImpl.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationImpl.java @@ -121,7 +121,7 @@ public String type() { } @Override - public RemediationImpl withManagementGroupId(String managementGroupId) { + public RemediationImpl withExistingMicrosoft.PolicyInsight(String managementGroupId) { this.managementGroupId = managementGroupId; return this; }