diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml b/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml index 7309eee1324ad..7013f5301146b 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml @@ -11,8 +11,8 @@ com.microsoft.azure azure-arm-parent - 1.2.0 - ../../parents/azure-arm-parent + 1.1.0 + ../../../pom.management.xml azure-mgmt-policyinsights 1.0.0-beta @@ -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/PolicyEvent.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvent.java new file mode 100644 index 0000000000000..9de88b27d2607 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvent.java @@ -0,0 +1,172 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyEventInner; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing PolicyEvent. + */ +public interface PolicyEvent extends HasInner, HasManager { + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the effectiveParameters value. + */ + String effectiveParameters(); + + /** + * @return the isCompliant value. + */ + Boolean isCompliant(); + + /** + * @return the managementGroupIds value. + */ + String managementGroupIds(); + + /** + * @return the odatacontext value. + */ + String odatacontext(); + + /** + * @return the odataid value. + */ + String odataid(); + + /** + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * @return the policyAssignmentName value. + */ + String policyAssignmentName(); + + /** + * @return the policyAssignmentOwner value. + */ + String policyAssignmentOwner(); + + /** + * @return the policyAssignmentParameters value. + */ + String policyAssignmentParameters(); + + /** + * @return the policyAssignmentScope value. + */ + String policyAssignmentScope(); + + /** + * @return the policyDefinitionAction value. + */ + String policyDefinitionAction(); + + /** + * @return the policyDefinitionCategory value. + */ + String policyDefinitionCategory(); + + /** + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * @return the policyDefinitionName value. + */ + String policyDefinitionName(); + + /** + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * @return the policySetDefinitionCategory value. + */ + String policySetDefinitionCategory(); + + /** + * @return the policySetDefinitionId value. + */ + String policySetDefinitionId(); + + /** + * @return the policySetDefinitionName value. + */ + String policySetDefinitionName(); + + /** + * @return the policySetDefinitionOwner value. + */ + String policySetDefinitionOwner(); + + /** + * @return the policySetDefinitionParameters value. + */ + String policySetDefinitionParameters(); + + /** + * @return the principalOid value. + */ + String principalOid(); + + /** + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the resourceLocation value. + */ + String resourceLocation(); + + /** + * @return the resourceTags value. + */ + String resourceTags(); + + /** + * @return the resourceType value. + */ + String resourceType(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the tenantId value. + */ + String tenantId(); + + /** + * @return the timestamp value. + */ + DateTime timestamp(); + +} diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java index b2473689228e8..c9df436763517 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java @@ -21,7 +21,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForManagementGroupAsync(String managementGroupName); + Observable listQueryResultsForManagementGroupAsync(final String managementGroupName); /** * Queries policy events for the resources under the subscription. @@ -30,7 +30,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForSubscriptionAsync(String subscriptionId); + Observable listQueryResultsForSubscriptionAsync(final String subscriptionId); /** * Queries policy events for the resources under the resource group. @@ -40,7 +40,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName); + Observable listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName); /** * Queries policy events for the resource. @@ -49,7 +49,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceAsync(String resourceId); + Observable listQueryResultsForResourceAsync(final String resourceId); /** * Queries policy events for the subscription level policy set definition. @@ -59,7 +59,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName); + Observable listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName); /** * Queries policy events for the subscription level policy definition. @@ -69,7 +69,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName); + Observable listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName); /** * Queries policy events for the subscription level policy assignment. @@ -79,7 +79,7 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName); + Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName); /** * Queries policy events for the resource group level policy assignment. @@ -90,15 +90,6 @@ public interface PolicyEvents { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName); - - /** - * Gets OData metadata XML document. - * - * @param scope A valid scope, i.e. management group, subscription, resource group, or resource ID. Scope used has no effect on metadata returned. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - Observable getMetadataAsync(String scope); + Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName); } 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 0000000000000..e6a4a957c20f0 --- /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 80d9ee03c2339..5a9063142f977 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/QueryOptions.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryOptions.java index 3e39597de6928..60648d56b9dfc 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryOptions.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryOptions.java @@ -63,6 +63,13 @@ public class QueryOptions { @JsonProperty(value = "") private String apply; + /** + * Skiptoken is only provided if a previous response returned a partial + * result as a part of nextLink element. + */ + @JsonProperty(value = "") + private String skipToken; + /** * The $expand query parameter. For example, to expand * policyEvaluationDetails, use $expand=policyEvaluationDetails. @@ -210,6 +217,26 @@ public QueryOptions withApply(String apply) { return this; } + /** + * Get skiptoken is only provided if a previous response returned a partial result as a part of nextLink element. + * + * @return the skipToken value + */ + public String skipToken() { + return this.skipToken; + } + + /** + * Set skiptoken is only provided if a previous response returned a partial result as a part of nextLink element. + * + * @param skipToken the skipToken value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withSkipToken(String skipToken) { + this.skipToken = skipToken; + return this; + } + /** * Get the $expand query parameter. For example, to expand policyEvaluationDetails, use $expand=policyEvaluationDetails. * 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 3e892d592505a..49d3df8de9afc 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/OperationsInner.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsInner.java index 7473be30a39de..639ad9a4b6a5c 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsInner.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsInner.java @@ -101,8 +101,10 @@ public OperationsListResultsInner call(ServiceResponse> listWithServiceResponseAsync() { - final String apiVersion = "2018-07-01-preview"; - return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -116,7 +118,7 @@ public Observable> call(Response listDelegate(Response response) throws QueryFailureException, IOException { + private ServiceResponse listDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(QueryFailureException.class) diff --git a/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 0000000000000..ca9e081b02d37 --- /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/PolicyEventImpl.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventImpl.java new file mode 100644 index 0000000000000..239bc460873ae --- /dev/null +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventImpl.java @@ -0,0 +1,178 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvent; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; +import org.joda.time.DateTime; + +class PolicyEventImpl extends WrapperImpl implements PolicyEvent { + private final PolicyInsightsManager manager; + PolicyEventImpl(PolicyEventInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public String effectiveParameters() { + return this.inner().effectiveParameters(); + } + + @Override + public Boolean isCompliant() { + return this.inner().isCompliant(); + } + + @Override + public String managementGroupIds() { + return this.inner().managementGroupIds(); + } + + @Override + public String odatacontext() { + return this.inner().odatacontext(); + } + + @Override + public String odataid() { + return this.inner().odataid(); + } + + @Override + public String policyAssignmentId() { + return this.inner().policyAssignmentId(); + } + + @Override + public String policyAssignmentName() { + return this.inner().policyAssignmentName(); + } + + @Override + public String policyAssignmentOwner() { + return this.inner().policyAssignmentOwner(); + } + + @Override + public String policyAssignmentParameters() { + return this.inner().policyAssignmentParameters(); + } + + @Override + public String policyAssignmentScope() { + return this.inner().policyAssignmentScope(); + } + + @Override + public String policyDefinitionAction() { + return this.inner().policyDefinitionAction(); + } + + @Override + public String policyDefinitionCategory() { + return this.inner().policyDefinitionCategory(); + } + + @Override + public String policyDefinitionId() { + return this.inner().policyDefinitionId(); + } + + @Override + public String policyDefinitionName() { + return this.inner().policyDefinitionName(); + } + + @Override + public String policyDefinitionReferenceId() { + return this.inner().policyDefinitionReferenceId(); + } + + @Override + public String policySetDefinitionCategory() { + return this.inner().policySetDefinitionCategory(); + } + + @Override + public String policySetDefinitionId() { + return this.inner().policySetDefinitionId(); + } + + @Override + public String policySetDefinitionName() { + return this.inner().policySetDefinitionName(); + } + + @Override + public String policySetDefinitionOwner() { + return this.inner().policySetDefinitionOwner(); + } + + @Override + public String policySetDefinitionParameters() { + return this.inner().policySetDefinitionParameters(); + } + + @Override + public String principalOid() { + return this.inner().principalOid(); + } + + @Override + public String resourceGroup() { + return this.inner().resourceGroup(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public String resourceLocation() { + return this.inner().resourceLocation(); + } + + @Override + public String resourceTags() { + return this.inner().resourceTags(); + } + + @Override + public String resourceType() { + return this.inner().resourceType(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + + @Override + public DateTime timestamp() { + return this.inner().timestamp(); + } + +} diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java index 1c884b5f26cfd..4b1d6edd33367 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java @@ -13,7 +13,8 @@ import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents; import rx.functions.Func1; import rx.Observable; -import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEventsQueryResults; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvent; class PolicyEventsImpl extends WrapperImpl implements PolicyEvents { private final PolicyInsightsManager manager; @@ -28,105 +29,147 @@ public PolicyInsightsManager manager() { } @Override - public Observable listQueryResultsForManagementGroupAsync(String managementGroupName) { + public Observable listQueryResultsForManagementGroupAsync(final String managementGroupName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForManagementGroupAsync(managementGroupName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForSubscriptionAsync(String subscriptionId) { + public Observable listQueryResultsForSubscriptionAsync(final String subscriptionId) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForSubscriptionAsync(subscriptionId) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) { + public Observable listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForResourceGroupAsync(subscriptionId, resourceGroupName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForResourceAsync(String resourceId) { + public Observable listQueryResultsForResourceAsync(final String resourceId) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForResourceAsync(resourceId) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { + public Observable listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForPolicySetDefinitionAsync(subscriptionId, policySetDefinitionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { + public Observable listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForPolicyDefinitionAsync(subscriptionId, policyDefinitionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { + public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(subscriptionId, policyAssignmentName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } @Override - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { PolicyEventsInner client = this.inner(); return client.listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(subscriptionId, resourceGroupName, policyAssignmentName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { - return new PolicyEventsQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyEvent call(PolicyEventInner inner) { + return new PolicyEventImpl(inner, manager()); } }); } - @Override - public Observable getMetadataAsync(String scope) { - PolicyEventsInner client = this.inner(); - return client.getMetadataAsync(scope) - ;} - } diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java index fa9b428e4eff7..eeca37ae295f6 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java @@ -10,13 +10,17 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryFailureException; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryOptions; -import com.microsoft.rest.ServiceCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import org.joda.time.DateTime; import retrofit2.http.GET; @@ -25,6 +29,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; @@ -57,39 +62,67 @@ public PolicyEventsInner(Retrofit retrofit, PolicyInsightsClientImpl client) { interface PolicyEventsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForManagementGroup" }) @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") - Observable> listQueryResultsForManagementGroup(@Path("policyEventsResource") String policyEventsResource, @Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForManagementGroup(@Path("policyEventsResource") String policyEventsResource, @Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForSubscription" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") - Observable> listQueryResultsForSubscription(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForSubscription(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceGroup" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") - Observable> listQueryResultsForResourceGroup(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForResourceGroup(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResource" }) @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") - Observable> listQueryResultsForResource(@Path("policyEventsResource") String policyEventsResource, @Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForResource(@Path("policyEventsResource") String policyEventsResource, @Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForPolicySetDefinition" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") - Observable> listQueryResultsForPolicySetDefinition(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policySetDefinitionName") String policySetDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForPolicySetDefinition(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policySetDefinitionName") String policySetDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForPolicyDefinition" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") - Observable> listQueryResultsForPolicyDefinition(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForPolicyDefinition(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForSubscriptionLevelPolicyAssignment" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") - Observable> listQueryResultsForSubscriptionLevelPolicyAssignment(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForSubscriptionLevelPolicyAssignment(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceGroupLevelPolicyAssignment" }) @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") - Observable> listQueryResultsForResourceGroupLevelPolicyAssignment(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForResourceGroupLevelPolicyAssignment(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents getMetadata" }) - @GET("{scope}/providers/Microsoft.PolicyInsights/policyEvents/$metadata") - Observable> getMetadata(@Path(value = "scope", encoded = true) String scope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForManagementGroupNext" }) + @GET + Observable> listQueryResultsForManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForSubscriptionNext" }) + @GET + Observable> listQueryResultsForSubscriptionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceGroupNext" }) + @GET + Observable> listQueryResultsForResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceNext" }) + @GET + Observable> listQueryResultsForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForPolicySetDefinitionNext" }) + @GET + Observable> listQueryResultsForPolicySetDefinitionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForPolicyDefinitionNext" }) + @GET + Observable> listQueryResultsForPolicyDefinitionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForSubscriptionLevelPolicyAssignmentNext" }) + @GET + Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceGroupLevelPolicyAssignmentNext" }) + @GET + Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -100,10 +133,16 @@ interface PolicyEventsService { * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName).toBlocking().single().body(); + public PagedList listQueryResultsForManagementGroup(final String managementGroupName) { + ServiceResponse> response = listQueryResultsForManagementGroupSinglePageAsync(managementGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -114,8 +153,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String m * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForManagementGroupAsync(String managementGroupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName), serviceCallback); + public ServiceFuture> listQueryResultsForManagementGroupAsync(final String managementGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupSinglePageAsync(managementGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -123,15 +170,16 @@ public ServiceFuture listQueryResultsForManagemen * * @param managementGroupName Management group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForManagementGroupAsync(String managementGroupName) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForManagementGroupAsync(final String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -139,15 +187,38 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForManagementGroupWithServiceResponseAsync(String managementGroupName) { + public Observable>> listQueryResultsForManagementGroupWithServiceResponseAsync(final String managementGroupName) { + return listQueryResultsForManagementGroupSinglePageAsync(managementGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForManagementGroupSinglePageAsync(final String managementGroupName) { if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -156,13 +227,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForManagementGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -178,10 +250,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName, QueryOptions queryOptions) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForManagementGroup(final String managementGroupName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -193,8 +271,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String m * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForManagementGroupAsync(final String managementGroupName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -203,15 +289,16 @@ public ServiceFuture listQueryResultsForManagemen * @param managementGroupName Management group name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions) { - return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForManagementGroupAsync(final String managementGroupName, final QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -220,16 +307,40 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForManagementGroupWithServiceResponseAsync(final String managementGroupName, final QueryOptions queryOptions) { + return listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + ServiceResponse> * @param managementGroupName Management group name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(String managementGroupName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForManagementGroupSinglePageAsync(final String managementGroupName, final QueryOptions queryOptions) { if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -258,13 +369,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForManagementGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -272,9 +387,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForManagementGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForManagementGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -286,10 +401,16 @@ private ServiceResponse listQueryResultsForManage * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + public PagedList listQueryResultsForSubscription(final String subscriptionId) { + ServiceResponse> response = listQueryResultsForSubscriptionSinglePageAsync(subscriptionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -300,8 +421,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subs * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionAsync(String subscriptionId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionAsync(final String subscriptionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionSinglePageAsync(subscriptionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -309,15 +438,37 @@ public ServiceFuture listQueryResultsForSubscript * * @param subscriptionId Microsoft Azure subscription ID. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForSubscriptionAsync(String subscriptionId) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionAsync(final String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForSubscriptionWithServiceResponseAsync(final String subscriptionId) { + return listQueryResultsForSubscriptionSinglePageAsync(subscriptionId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -325,14 +476,16 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionWithServiceResponseAsync(String subscriptionId) { + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final String subscriptionId) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -341,13 +494,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForSubscription(policyEventsResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForSubscription(policyEventsResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -363,10 +517,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForSubscription(final String subscriptionId, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForSubscriptionSinglePageAsync(subscriptionId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -378,8 +538,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subs * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionAsync(final String subscriptionId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionSinglePageAsync(subscriptionId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -388,15 +556,16 @@ public ServiceFuture listQueryResultsForSubscript * @param subscriptionId Microsoft Azure subscription ID. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionAsync(final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -405,15 +574,39 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionWithServiceResponseAsync(final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionSinglePageAsync(subscriptionId, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(String subscriptionId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final String subscriptionId, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -442,13 +635,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForSubscription(policyEventsResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForSubscription(policyEventsResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -456,9 +653,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForSubscriptionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForSubscriptionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -471,10 +668,16 @@ private ServiceResponse listQueryResultsForSubscr * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroup(final String subscriptionId, final String resourceGroupName) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -486,8 +689,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String sub * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -496,15 +707,38 @@ public ServiceFuture listQueryResultsForResourceG * @param subscriptionId Microsoft Azure subscription ID. * @param resourceGroupName Resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName) { + return listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -513,17 +747,19 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName) { + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final String subscriptionId, final String resourceGroupName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -532,13 +768,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -555,10 +792,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroup(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -571,8 +814,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String sub * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -582,15 +833,16 @@ public ServiceFuture listQueryResultsForResourceG * @param resourceGroupName Resource group name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -600,18 +852,43 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -640,13 +917,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -654,9 +935,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -668,10 +949,16 @@ private ServiceResponse listQueryResultsForResour * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId) { - return listQueryResultsForResourceWithServiceResponseAsync(resourceId).toBlocking().single().body(); + public PagedList listQueryResultsForResource(final String resourceId) { + ServiceResponse> response = listQueryResultsForResourceSinglePageAsync(resourceId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -682,8 +969,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResource(String resource * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceAsync(String resourceId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(resourceId), serviceCallback); + public ServiceFuture> listQueryResultsForResourceAsync(final String resourceId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceSinglePageAsync(resourceId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -691,15 +986,37 @@ public ServiceFuture listQueryResultsForResourceA * * @param resourceId Resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceAsync(String resourceId) { - return listQueryResultsForResourceWithServiceResponseAsync(resourceId).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceAsync(final String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceWithServiceResponseAsync(final String resourceId) { + return listQueryResultsForResourceSinglePageAsync(resourceId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -707,14 +1024,16 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForResourceWithServiceResponseAsync(String resourceId) { + public Observable>> listQueryResultsForResourceSinglePageAsync(final String resourceId) { if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -723,13 +1042,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResource(policyEventsResource, resourceId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForResource(policyEventsResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -745,10 +1065,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId, QueryOptions queryOptions) { - return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResource(final String resourceId, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceSinglePageAsync(resourceId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -760,8 +1086,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResource(String resource * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceAsync(String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceAsync(final String resourceId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceSinglePageAsync(resourceId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -770,15 +1104,16 @@ public ServiceFuture listQueryResultsForResourceA * @param resourceId Resource ID. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceAsync(String resourceId, QueryOptions queryOptions) { - return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceAsync(final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -787,15 +1122,39 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceWithServiceResponseAsync(final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceSinglePageAsync(resourceId, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource. + * + ServiceResponse> * @param resourceId Resource ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceWithServiceResponseAsync(String resourceId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceSinglePageAsync(final String resourceId, final QueryOptions queryOptions) { if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -824,13 +1183,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResource(policyEventsResource, resourceId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForResource(policyEventsResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -838,9 +1201,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -853,10 +1216,16 @@ private ServiceResponse listQueryResultsForResour * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).toBlocking().single().body(); + public PagedList listQueryResultsForPolicySetDefinition(final String subscriptionId, final String policySetDefinitionName) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -868,8 +1237,34 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(Stri * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); + public ServiceFuture> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -878,15 +1273,20 @@ public ServiceFuture listQueryResultsForPolicySet * @param subscriptionId Microsoft Azure subscription ID. * @param policySetDefinitionName Policy set definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable>> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(final String subscriptionId, final String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -895,18 +1295,20 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName) { + public Observable>> listQueryResultsForPolicySetDefinitionSinglePageAsync(final String subscriptionId, final String policySetDefinitionName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -915,13 +1317,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForPolicySetDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForPolicySetDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -938,10 +1341,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForPolicySetDefinition(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -954,8 +1363,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(Stri * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -965,15 +1382,16 @@ public ServiceFuture listQueryResultsForPolicySet * @param policySetDefinitionName Policy set definition name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -983,19 +1401,44 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policySetDefinitionName Policy set definition name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForPolicySetDefinitionSinglePageAsync(final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1024,13 +1467,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForPolicySetDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForPolicySetDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1038,9 +1485,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1053,10 +1500,16 @@ private ServiceResponse listQueryResultsForPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).toBlocking().single().body(); + public PagedList listQueryResultsForPolicyDefinition(final String subscriptionId, final String policyDefinitionName) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1068,8 +1521,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName), serviceCallback); + public ServiceFuture> listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1078,15 +1539,38 @@ public ServiceFuture listQueryResultsForPolicyDef * @param subscriptionId Microsoft Azure subscription ID. * @param policyDefinitionName Policy definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(final String subscriptionId, final String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -1095,18 +1579,20 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { + public Observable>> listQueryResultsForPolicyDefinitionSinglePageAsync(final String subscriptionId, final String policyDefinitionName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1115,13 +1601,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1138,10 +1625,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForPolicyDefinition(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1154,8 +1647,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1165,15 +1666,16 @@ public ServiceFuture listQueryResultsForPolicyDef * @param policyDefinitionName Policy definition name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicyDefinitionAsync(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1183,19 +1685,44 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionSinglePageAsync(subscriptionId, policyDefinitionName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policyDefinitionName Policy definition name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForPolicyDefinitionSinglePageAsync(final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1224,13 +1751,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1238,9 +1769,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1253,10 +1784,16 @@ private ServiceResponse listQueryResultsForPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).toBlocking().single().body(); + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignment(final String subscriptionId, final String policyAssignmentName) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1268,8 +1805,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyA * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1278,15 +1823,38 @@ public ServiceFuture listQueryResultsForSubscript * @param subscriptionId Microsoft Azure subscription ID. * @param policyAssignmentName Policy assignment name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(final String subscriptionId, final String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -1295,18 +1863,20 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName) { + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(final String subscriptionId, final String policyAssignmentName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1315,13 +1885,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1338,10 +1909,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignment(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1354,8 +1931,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyA * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1365,15 +1950,16 @@ public ServiceFuture listQueryResultsForSubscript * @param policyAssignmentName Policy assignment name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1383,19 +1969,44 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(subscriptionId, policyAssignmentName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policyAssignmentName Policy assignment name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1424,13 +2035,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1438,9 +2053,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1454,10 +2069,16 @@ private ServiceResponse listQueryResultsForSubscr * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignment(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1470,8 +2091,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1481,15 +2110,39 @@ public ServiceFuture listQueryResultsForResourceG * @param resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -1499,9 +2152,9 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } @@ -1511,9 +2164,11 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1522,13 +2177,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1546,10 +2202,16 @@ public Observable> call(Response< * @throws IllegalArgumentException thrown if parameters fail the validation * @throws QueryFailureException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PolicyEventsQueryResultsInner object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single().body(); + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignment(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1563,8 +2225,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1575,15 +2245,16 @@ public ServiceFuture listQueryResultsForResourceG * @param policyAssignmentName Policy assignment name. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1594,9 +2265,33 @@ public PolicyEventsQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param policyAssignmentName Policy assignment name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } @@ -1606,10 +2301,12 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1638,13 +2335,128 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the resources under the management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForManagementGroupNextAsync(final String nextPageLink) { + return listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForManagementGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listQueryResultsForManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1652,73 +2464,776 @@ 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> 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); } /** - * Gets OData metadata XML document. + * Queries policy events for the resources under the subscription. * - * @param scope A valid scope, i.e. management group, subscription, resource group, or resource ID. Scope used has no effect on metadata returned. + * @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 String object if successful. + * @return the PagedList<PolicyEventInner> object if successful. */ - public String getMetadata(String scope) { - return getMetadataWithServiceResponseAsync(scope).toBlocking().single().body(); + 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(); + } + }; } /** - * Gets OData metadata XML document. + * Queries policy events for the resources under the subscription. * - * @param scope A valid scope, i.e. management group, subscription, resource group, or resource ID. Scope used has no effect on metadata returned. + * @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 getMetadataAsync(String scope, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getMetadataWithServiceResponseAsync(scope), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForSubscriptionNextAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForSubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForSubscriptionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listQueryResultsForSubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForSubscriptionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); } /** - * Gets OData metadata XML document. + * Queries policy events for the resources under the resource group. * - * @param scope A valid scope, i.e. management group, subscription, resource group, or resource ID. Scope used has no effect on metadata returned. + * @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 String object + * @throws QueryFailureException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyEventInner> object if successful. */ - public Observable getMetadataAsync(String scope) { - return getMetadataWithServiceResponseAsync(scope).map(new Func1, String>() { + public PagedList listQueryResultsForResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { @Override - public String call(ServiceResponse response) { - return response.body(); + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } - }); + }; + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForResourceGroupNextAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Gets OData metadata XML document. + * Queries policy events for the resources under the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listQueryResultsForResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForResourceGroupNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForResourceNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForResourceNextAsync(final String nextPageLink) { + return listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listQueryResultsForResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForResourceNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForPolicySetDefinitionNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForPolicySetDefinitionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForPolicySetDefinitionNextAsync(final String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listQueryResultsForPolicySetDefinitionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForPolicySetDefinitionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForPolicySetDefinitionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForPolicyDefinitionNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForPolicyDefinitionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForPolicyDefinitionNextAsync(final String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForPolicyDefinitionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listQueryResultsForPolicyDefinitionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForPolicyDefinitionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForPolicyDefinitionNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForSubscriptionLevelPolicyAssignmentNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForSubscriptionLevelPolicyAssignmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentNextAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listQueryResultsForSubscriptionLevelPolicyAssignmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentNextDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws QueryFailureException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyEventInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroupLevelPolicyAssignmentNext(final String nextPageLink) { + ServiceResponse> response = listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listQueryResultsForResourceGroupLevelPolicyAssignmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentNextAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(final String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy events for the resource group level policy assignment. * - * @param scope A valid scope, i.e. management group, subscription, resource group, or resource ID. Scope used has no effect on metadata returned. + ServiceResponse> * @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 String object + * @return the PagedList<PolicyEventInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> getMetadataWithServiceResponseAsync(String scope) { - if (scope == null) { - throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } - final String apiVersion = "2018-04-04"; - return service.getMetadata(scope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + 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) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = getMetadataDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1726,9 +3241,9 @@ public Observable> call(Response response) }); } - private ServiceResponse getMetadataDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + 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/PolicyInsightsClientImpl.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java index d8a9470043a2b..537ec056035bd 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java @@ -28,6 +28,18 @@ public AzureClient getAzureClient() { return this.azureClient; } + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + /** The preferred language for the response. */ private String acceptLanguage; @@ -193,6 +205,7 @@ public PolicyInsightsClientImpl(RestClient restClient) { } protected void initialize() { + this.apiVersion = "2018-07-01-preview"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -211,6 +224,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "PolicyInsightsClient", "2018-07-01-preiew"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "PolicyInsightsClient", "2018-07-01-preview"); } } diff --git a/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 0000000000000..8f4bedda909d8 --- /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 2b650a74467a5..5f3e29d72fe19 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 f52804758294c..1afdac615baa1 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; @@ -58,7 +64,7 @@ public PolicyStatesInner(Retrofit retrofit, PolicyInsightsClientImpl client) { interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForManagementGroup" }) @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") - Observable> listQueryResultsForManagementGroup(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForManagementGroup(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @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 summarizeForManagementGroup" }) @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -66,7 +72,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForSubscription" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") - Observable> listQueryResultsForSubscription(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForSubscription(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @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 summarizeForSubscription" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -74,7 +80,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResourceGroup" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") - Observable> listQueryResultsForResourceGroup(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForResourceGroup(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @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 summarizeForResourceGroup" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -82,7 +88,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResource" }) @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") - Observable> listQueryResultsForResource(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$expand") String expand, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForResource(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$expand") String expand, @Query("$skiptoken") String skipToken, @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 summarizeForResource" }) @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -90,7 +96,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForPolicySetDefinition" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") - Observable> listQueryResultsForPolicySetDefinition(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policySetDefinitionName") String policySetDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForPolicySetDefinition(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policySetDefinitionName") String policySetDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @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 summarizeForPolicySetDefinition" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -98,7 +104,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForPolicyDefinition" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") - Observable> listQueryResultsForPolicyDefinition(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForPolicyDefinition(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @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 summarizeForPolicyDefinition" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -106,7 +112,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForSubscriptionLevelPolicyAssignment" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") - Observable> listQueryResultsForSubscriptionLevelPolicyAssignment(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForSubscriptionLevelPolicyAssignment(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @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 summarizeForSubscriptionLevelPolicyAssignment" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -114,7 +120,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResourceGroupLevelPolicyAssignment" }) @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") - Observable> listQueryResultsForResourceGroupLevelPolicyAssignment(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + Observable> listQueryResultsForResourceGroupLevelPolicyAssignment(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$skiptoken") String skipToken, @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 summarizeForResourceGroupLevelPolicyAssignment" }) @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -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,17 +251,19 @@ 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."); } if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -195,13 +272,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForManagementGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -218,10 +296,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 +318,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 +337,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,18 +356,43 @@ 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."); } if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -303,13 +421,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForManagementGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -317,9 +439,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); } @@ -376,15 +498,17 @@ public Observable> summarizeForManagement if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -454,10 +578,12 @@ public Observable> summarizeForManagement if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -474,7 +600,7 @@ public Observable> summarizeForManagement if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -503,10 +629,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 +650,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 +668,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,16 +708,18 @@ 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."); } if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -563,13 +728,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -586,10 +752,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 +774,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 +793,16 @@ public ServiceFuture listQueryResultsForSubscript * @param subscriptionId Microsoft Azure subscription ID. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) { - return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -631,17 +812,42 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the subscription. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -670,13 +876,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -684,9 +894,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForSubscriptionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForSubscriptionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -743,14 +953,16 @@ public Observable> summarizeForSubscripti if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -820,9 +1032,11 @@ public Observable> summarizeForSubscripti if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -839,7 +1053,7 @@ public Observable> summarizeForSubscripti if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -869,10 +1083,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 +1105,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 +1124,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 +1166,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."); } @@ -926,7 +1178,9 @@ public Observable> listQueryResul if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -935,13 +1189,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -959,10 +1214,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 +1237,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 +1257,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 +1277,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceGroupWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the resource group. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -1019,8 +1313,10 @@ public Observable> listQueryResul if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1049,13 +1345,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1063,9 +1363,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1129,14 +1429,16 @@ public Observable> summarizeForResourceGr if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1213,9 +1515,11 @@ public Observable> summarizeForResourceGr if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1232,7 +1536,7 @@ public Observable> summarizeForResourceGr if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1261,10 +1565,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 +1586,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 +1604,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,16 +1644,18 @@ 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."); } if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1322,13 +1665,14 @@ public Observable> listQueryResul String filter = null; String apply = null; String expand = null; - return service.listQueryResultsForResource(policyStatesResource, resourceId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, expand, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForResource(policyStatesResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, expand, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1345,10 +1689,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 +1711,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 +1730,16 @@ public ServiceFuture listQueryResultsForResourceA * @param resourceId Resource ID. * @param queryOptions Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { - return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1390,17 +1749,42 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { + public Observable>> 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>> listQueryResultsForResourceSinglePageAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1433,13 +1817,17 @@ public Observable> listQueryResul if (queryOptions != null) { expand = queryOptions.expand(); } - return service.listQueryResultsForResource(policyStatesResource, resourceId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, expand, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForResource(policyStatesResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, expand, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1447,9 +1835,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1506,14 +1894,16 @@ public Observable> summarizeForResourceWi if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForResource(policyStatesSummaryResource, resourceId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResource(policyStatesSummaryResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1583,9 +1973,11 @@ public Observable> summarizeForResourceWi if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1602,7 +1994,7 @@ public Observable> summarizeForResourceWi if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForResource(policyStatesSummaryResource, resourceId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResource(policyStatesSummaryResource, resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1632,10 +2024,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 +2046,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 +2065,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 +2107,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."); } @@ -1689,8 +2119,10 @@ public Observable> listQueryResul if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1699,13 +2131,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1723,10 +2156,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 +2179,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 +2199,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 +2219,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policySetDefinitionName Policy set definition name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForPolicySetDefinitionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -1783,9 +2255,11 @@ public Observable> listQueryResul if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1814,13 +2288,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1828,9 +2306,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -1894,15 +2372,17 @@ public Observable> summarizeForPolicySetD if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1979,10 +2459,12 @@ public Observable> summarizeForPolicySetD if (policySetDefinitionName == null) { throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1999,7 +2481,7 @@ public Observable> summarizeForPolicySetD if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2029,10 +2511,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 +2533,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 +2552,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 +2594,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."); } @@ -2086,8 +2606,10 @@ public Observable> listQueryResul if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -2096,13 +2618,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2120,10 +2643,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 +2666,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 +2686,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 +2706,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionSinglePageAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicyDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy definition. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policyDefinitionName Policy definition name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForPolicyDefinitionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2180,9 +2742,11 @@ public Observable> listQueryResul if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2211,13 +2775,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2225,9 +2793,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -2291,15 +2859,17 @@ public Observable> summarizeForPolicyDefi if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2376,10 +2946,12 @@ public Observable> summarizeForPolicyDefi if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2396,7 +2968,7 @@ public Observable> summarizeForPolicyDefi if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2426,10 +2998,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 +3020,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 +3039,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 +3081,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2483,8 +3093,10 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -2493,13 +3105,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2517,10 +3130,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 +3153,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 +3173,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 +3193,33 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param policyAssignmentName Policy assignment name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -2577,9 +3229,11 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2608,13 +3262,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2622,9 +3280,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -2688,15 +3346,17 @@ public Observable> summarizeForSubscripti if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2773,10 +3433,12 @@ public Observable> summarizeForSubscripti if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2793,7 +3455,7 @@ public Observable> summarizeForSubscripti if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2824,10 +3486,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 +3509,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicy * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + public ServiceFuture> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -2853,15 +3529,40 @@ public ServiceFuture listQueryResultsForResourceG * @param resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable to the PagedList<PolicyStateInner> object */ - public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1, PolicyStatesQueryResultsInner>() { - @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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>> 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 +3573,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."); } @@ -2887,8 +3588,10 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -2897,13 +3600,14 @@ public Observable> listQueryResul DateTime to = null; String filter = null; String apply = null; - return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2922,10 +3626,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 +3650,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 +3671,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 +3692,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."); } @@ -2988,9 +3732,11 @@ public Observable> listQueryResul if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -3019,13 +3765,17 @@ public Observable> listQueryResul if (queryOptions != null) { apply = queryOptions.apply(); } - return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, skipToken, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -3033,9 +3783,9 @@ public Observable> call(Response< }); } - private ServiceResponse listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(QueryFailureException.class) .build(response); } @@ -3106,15 +3856,17 @@ public Observable> summarizeForResourceGr if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; DateTime from = null; DateTime to = null; String filter = null; - return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3198,10 +3950,12 @@ public Observable> summarizeForResourceGr if (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -3218,7 +3972,7 @@ public Observable> summarizeForResourceGr if (queryOptions != null) { filter = queryOptions.filter(); } - return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3291,8 +4045,10 @@ public Observable> getMetadataWithServiceResponseAsync(S if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.getMetadata(scope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getMetadata(scope, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3313,4 +4069,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/PolicyTrackedResourcesInner.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java index fa1354dda1796..81aa98c40855e 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java @@ -181,13 +181,15 @@ public Observable>> listQueryRe if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -294,10 +296,12 @@ public Observable>> listQueryRe if (managementGroupName == null) { throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String managementGroupsNamespace = "Microsoft.Management"; final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -306,7 +310,7 @@ public Observable>> listQueryRe if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -415,12 +419,14 @@ public Observable>> listQueryRe if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -527,9 +533,11 @@ public Observable>> listQueryRe if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -538,7 +546,7 @@ public Observable>> listQueryRe if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -655,12 +663,14 @@ public Observable>> listQueryRe if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -775,9 +785,11 @@ public Observable>> listQueryRe if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -786,7 +798,7 @@ public Observable>> listQueryRe if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -895,12 +907,14 @@ public Observable>> listQueryRe if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1007,9 +1021,11 @@ public Observable>> listQueryRe if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String policyTrackedResourcesResource = "default"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1018,7 +1034,7 @@ public Observable>> listQueryRe if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { diff --git a/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 ef922cadedfe7..bb0988bbdd836 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; } diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java index 12edd06ce8509..616969ac5ecc8 100644 --- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java +++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java @@ -289,11 +289,13 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; - return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -408,14 +410,16 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); } - return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -495,9 +499,11 @@ public Observable> cancelAtManagementGroupWith if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; - return service.cancelAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.cancelAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -606,12 +612,14 @@ public Observable>> listForManagementGrou if (managementGroupId == null) { throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -718,9 +726,11 @@ public Observable>> listForManagementGrou if (managementGroupId == null) { throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -729,7 +739,7 @@ public Observable>> listForManagementGrou if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -813,13 +823,15 @@ public Observable> createOrUpdateAtManagementG if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; - return service.createOrUpdateAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -900,9 +912,11 @@ public Observable> getAtManagementGroupWithSer if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; - return service.getAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.getAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -982,9 +996,11 @@ public Observable> deleteAtManagementGroupWith if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-07-01-preview"; - return service.deleteAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.deleteAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1102,10 +1118,12 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; - return service.listDeploymentsAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1220,13 +1238,15 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); } - return service.listDeploymentsAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1306,8 +1326,10 @@ public Observable> cancelAtSubscriptionWithSer if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.cancelAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancelAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1416,11 +1438,13 @@ public Observable>> listSinglePageAsync(f if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.list(subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.list(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1527,8 +1551,10 @@ public Observable>> listSinglePageAsync(f if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1537,7 +1563,7 @@ public Observable>> listSinglePageAsync(f if (queryOptions != null) { filter = queryOptions.filter(); } - return service.list(subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.list(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1621,12 +1647,14 @@ public Observable> createOrUpdateAtSubscriptio if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - final String apiVersion = "2018-07-01-preview"; - return service.createOrUpdateAtSubscription(subscriptionId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1707,8 +1735,10 @@ public Observable> getAtSubscriptionWithServic if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.getAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1788,8 +1818,10 @@ public Observable> deleteAtSubscriptionWithSer if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.deleteAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtSubscription(subscriptionId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1915,10 +1947,12 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; - return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2041,13 +2075,15 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); } - return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2134,8 +2170,10 @@ public Observable> cancelAtResourceGroupWithSe if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.cancelAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancelAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2252,11 +2290,13 @@ public Observable>> listByResourceGroupSi if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listByResourceGroup(subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listByResourceGroup(subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2371,8 +2411,10 @@ public Observable>> listByResourceGroupSi if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -2381,7 +2423,7 @@ public Observable>> listByResourceGroupSi if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listByResourceGroup(subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listByResourceGroup(subscriptionId, resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2472,12 +2514,14 @@ public Observable> createOrUpdateAtResourceGro if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - final String apiVersion = "2018-07-01-preview"; - return service.createOrUpdateAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2565,8 +2609,10 @@ public Observable> getByResourceGroupWithServi if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.getByResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2653,8 +2699,10 @@ public Observable> deleteAtResourceGroupWithSe if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.deleteAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtResourceGroup(subscriptionId, resourceGroupName, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2772,10 +2820,12 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; - return service.listDeploymentsAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2890,13 +2940,15 @@ public Observable>> listDeploym if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); } - return service.listDeploymentsAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + return service.listDeploymentsAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), top, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -2976,8 +3028,10 @@ public Observable> cancelAtResourceWithService if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.cancelAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancelAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3086,11 +3140,13 @@ public Observable>> listForResourceSingle if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } final QueryOptions queryOptions = null; Integer top = null; String filter = null; - return service.listForResource(resourceId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listForResource(resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -3197,8 +3253,10 @@ public Observable>> listForResourceSingle if (resourceId == null) { throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } Validator.validate(queryOptions); - final String apiVersion = "2018-07-01-preview"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -3207,7 +3265,7 @@ public Observable>> listForResourceSingle if (queryOptions != null) { filter = queryOptions.filter(); } - return service.listForResource(resourceId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + return service.listForResource(resourceId, this.client.apiVersion(), this.client.acceptLanguage(), top, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -3291,12 +3349,14 @@ public Observable> createOrUpdateAtResourceWit if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - final String apiVersion = "2018-07-01-preview"; - return service.createOrUpdateAtResource(resourceId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateAtResource(resourceId, remediationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3377,8 +3437,10 @@ public Observable> getAtResourceWithServiceRes if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.getAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -3458,8 +3520,10 @@ public Observable> deleteAtResourceWithService if (remediationName == null) { throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); } - final String apiVersion = "2018-07-01-preview"; - return service.deleteAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtResource(resourceId, remediationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) {