diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml b/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml
index 99d6e8bbf63e..7013f5301146 100644
--- a/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml
+++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/pom.xml
@@ -11,7 +11,7 @@
com.microsoft.azure
azure-arm-parent
- 1.2.0
+ 1.1.0
../../../pom.management.xml
azure-mgmt-policyinsights
@@ -71,6 +71,8 @@
azure-arm-client-runtime
test-jar
test
+
+ 1.6.5
diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyState.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyState.java
new file mode 100644
index 000000000000..e6a4a957c20f
--- /dev/null
+++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyState.java
@@ -0,0 +1,172 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.policyinsights.v2018_07_01_preview;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager;
+import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyStateInner;
+import java.util.Map;
+import org.joda.time.DateTime;
+
+/**
+ * Type representing PolicyState.
+ */
+public interface PolicyState extends HasInner, HasManager {
+ /**
+ * @return the additionalProperties value.
+ */
+ Map additionalProperties();
+
+ /**
+ * @return the complianceState value.
+ */
+ String complianceState();
+
+ /**
+ * @return the effectiveParameters value.
+ */
+ String effectiveParameters();
+
+ /**
+ * @return the isCompliant value.
+ */
+ Boolean isCompliant();
+
+ /**
+ * @return the managementGroupIds value.
+ */
+ String managementGroupIds();
+
+ /**
+ * @return the odatacontext value.
+ */
+ String odatacontext();
+
+ /**
+ * @return the odataid value.
+ */
+ String odataid();
+
+ /**
+ * @return the policyAssignmentId value.
+ */
+ String policyAssignmentId();
+
+ /**
+ * @return the policyAssignmentName value.
+ */
+ String policyAssignmentName();
+
+ /**
+ * @return the policyAssignmentOwner value.
+ */
+ String policyAssignmentOwner();
+
+ /**
+ * @return the policyAssignmentParameters value.
+ */
+ String policyAssignmentParameters();
+
+ /**
+ * @return the policyAssignmentScope value.
+ */
+ String policyAssignmentScope();
+
+ /**
+ * @return the policyDefinitionAction value.
+ */
+ String policyDefinitionAction();
+
+ /**
+ * @return the policyDefinitionCategory value.
+ */
+ String policyDefinitionCategory();
+
+ /**
+ * @return the policyDefinitionId value.
+ */
+ String policyDefinitionId();
+
+ /**
+ * @return the policyDefinitionName value.
+ */
+ String policyDefinitionName();
+
+ /**
+ * @return the policyDefinitionReferenceId value.
+ */
+ String policyDefinitionReferenceId();
+
+ /**
+ * @return the policyEvaluationDetails value.
+ */
+ PolicyEvaluationDetails policyEvaluationDetails();
+
+ /**
+ * @return the policySetDefinitionCategory value.
+ */
+ String policySetDefinitionCategory();
+
+ /**
+ * @return the policySetDefinitionId value.
+ */
+ String policySetDefinitionId();
+
+ /**
+ * @return the policySetDefinitionName value.
+ */
+ String policySetDefinitionName();
+
+ /**
+ * @return the policySetDefinitionOwner value.
+ */
+ String policySetDefinitionOwner();
+
+ /**
+ * @return the policySetDefinitionParameters value.
+ */
+ String policySetDefinitionParameters();
+
+ /**
+ * @return the resourceGroup value.
+ */
+ String resourceGroup();
+
+ /**
+ * @return the resourceId value.
+ */
+ String resourceId();
+
+ /**
+ * @return the resourceLocation value.
+ */
+ String resourceLocation();
+
+ /**
+ * @return the resourceTags value.
+ */
+ String resourceTags();
+
+ /**
+ * @return the resourceType value.
+ */
+ String resourceType();
+
+ /**
+ * @return the subscriptionId value.
+ */
+ String subscriptionId();
+
+ /**
+ * @return the timestamp value.
+ */
+ DateTime timestamp();
+
+}
diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java
index 80d9ee03c233..5a9063142f97 100644
--- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java
+++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java
@@ -22,7 +22,7 @@ public interface PolicyStates {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
- Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName);
+ Observable listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName);
/**
* Summarizes policy states for the resources under the management group.
@@ -41,7 +41,7 @@ public interface PolicyStates {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
- Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId);
+ Observable listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId);
/**
* Summarizes policy states for the resources under the subscription.
@@ -61,7 +61,7 @@ public interface PolicyStates {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
- Observable listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName);
+ Observable listQueryResultsForResourceGroupAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName);
/**
* Summarizes policy states for the resources under the resource group.
@@ -81,7 +81,7 @@ public interface PolicyStates {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
- Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId);
+ Observable listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId);
/**
* Summarizes policy states for the resource.
@@ -101,7 +101,7 @@ public interface PolicyStates {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
- Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName);
+ Observable listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName);
/**
* Summarizes policy states for the subscription level policy set definition.
@@ -122,7 +122,7 @@ public interface PolicyStates {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
- Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName);
+ Observable listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName);
/**
* Summarizes policy states for the subscription level policy definition.
@@ -143,7 +143,7 @@ public interface PolicyStates {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
- Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName);
+ Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName);
/**
* Summarizes policy states for the subscription level policy assignment.
@@ -165,7 +165,7 @@ public interface PolicyStates {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
- Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName);
+ Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName);
/**
* Summarizes policy states for the resource group level policy assignment.
diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java
index 3e892d592505..49d3df8de9af 100644
--- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java
+++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java
@@ -75,7 +75,7 @@ public interface Remediation extends HasInner, Indexable, Upda
/**
* The entirety of the Remediation definition.
*/
- interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagementGroup, DefinitionStages.WithCreate {
+ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithMicrosoft.PolicyInsight, DefinitionStages.WithCreate {
}
/**
@@ -85,19 +85,19 @@ interface DefinitionStages {
/**
* The first stage of a Remediation definition.
*/
- interface Blank extends WithManagementGroup {
+ interface Blank extends WithMicrosoft.PolicyInsight {
}
/**
* The stage of the remediation definition allowing to specify Microsoft.PolicyInsight.
*/
- interface WithManagementGroup {
+ interface WithMicrosoft.PolicyInsight {
/**
* Specifies managementGroupId.
* @param managementGroupId Management group ID
* @return the next definition stage
*/
- WithCreate withManagementGroupId(String managementGroupId);
+ WithCreate withExistingMicrosoft.PolicyInsight(String managementGroupId);
}
/**
diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl1.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl1.java
new file mode 100644
index 000000000000..ca9e081b02d3
--- /dev/null
+++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl1.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.microsoft.azure.Page;
+import java.util.List;
+
+/**
+ * An instance of this class defines a page of Azure resources and a link to
+ * get the next page of resources, if any.
+ *
+ * @param type of Azure resource
+ */
+public class PageImpl1 implements Page {
+ /**
+ * The link to the next page.
+ */
+ @JsonProperty("@odata.nextLink")
+ private String nextPageLink;
+
+ /**
+ * The list of items.
+ */
+ @JsonProperty("value")
+ private List items;
+
+ /**
+ * Gets the link to the next page.
+ *
+ * @return the link to the next page.
+ */
+ @Override
+ public String nextPageLink() {
+ return this.nextPageLink;
+ }
+
+ /**
+ * Gets the list of items.
+ *
+ * @return the list of items in {@link List}.
+ */
+ @Override
+ public List items() {
+ return items;
+ }
+
+ /**
+ * Sets the link to the next page.
+ *
+ * @param nextPageLink the link to the next page.
+ * @return this Page object itself.
+ */
+ public PageImpl1 setNextPageLink(String nextPageLink) {
+ this.nextPageLink = nextPageLink;
+ return this;
+ }
+
+ /**
+ * Sets the list of items.
+ *
+ * @param items the list of items in {@link List}.
+ * @return this Page object itself.
+ */
+ public PageImpl1 setItems(List items) {
+ this.items = items;
+ return this;
+ }
+}
diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateImpl.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateImpl.java
new file mode 100644
index 000000000000..8f4bedda909d
--- /dev/null
+++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateImpl.java
@@ -0,0 +1,179 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation;
+
+import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyState;
+import com.microsoft.azure.arm.model.implementation.WrapperImpl;
+import java.util.Map;
+import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvaluationDetails;
+import org.joda.time.DateTime;
+
+class PolicyStateImpl extends WrapperImpl implements PolicyState {
+ private final PolicyInsightsManager manager;
+ PolicyStateImpl(PolicyStateInner inner, PolicyInsightsManager manager) {
+ super(inner);
+ this.manager = manager;
+ }
+
+ @Override
+ public PolicyInsightsManager manager() {
+ return this.manager;
+ }
+
+ @Override
+ public Map additionalProperties() {
+ return this.inner().additionalProperties();
+ }
+
+ @Override
+ public String complianceState() {
+ return this.inner().complianceState();
+ }
+
+ @Override
+ public String effectiveParameters() {
+ return this.inner().effectiveParameters();
+ }
+
+ @Override
+ public Boolean isCompliant() {
+ return this.inner().isCompliant();
+ }
+
+ @Override
+ public String managementGroupIds() {
+ return this.inner().managementGroupIds();
+ }
+
+ @Override
+ public String odatacontext() {
+ return this.inner().odatacontext();
+ }
+
+ @Override
+ public String odataid() {
+ return this.inner().odataid();
+ }
+
+ @Override
+ public String policyAssignmentId() {
+ return this.inner().policyAssignmentId();
+ }
+
+ @Override
+ public String policyAssignmentName() {
+ return this.inner().policyAssignmentName();
+ }
+
+ @Override
+ public String policyAssignmentOwner() {
+ return this.inner().policyAssignmentOwner();
+ }
+
+ @Override
+ public String policyAssignmentParameters() {
+ return this.inner().policyAssignmentParameters();
+ }
+
+ @Override
+ public String policyAssignmentScope() {
+ return this.inner().policyAssignmentScope();
+ }
+
+ @Override
+ public String policyDefinitionAction() {
+ return this.inner().policyDefinitionAction();
+ }
+
+ @Override
+ public String policyDefinitionCategory() {
+ return this.inner().policyDefinitionCategory();
+ }
+
+ @Override
+ public String policyDefinitionId() {
+ return this.inner().policyDefinitionId();
+ }
+
+ @Override
+ public String policyDefinitionName() {
+ return this.inner().policyDefinitionName();
+ }
+
+ @Override
+ public String policyDefinitionReferenceId() {
+ return this.inner().policyDefinitionReferenceId();
+ }
+
+ @Override
+ public PolicyEvaluationDetails policyEvaluationDetails() {
+ return this.inner().policyEvaluationDetails();
+ }
+
+ @Override
+ public String policySetDefinitionCategory() {
+ return this.inner().policySetDefinitionCategory();
+ }
+
+ @Override
+ public String policySetDefinitionId() {
+ return this.inner().policySetDefinitionId();
+ }
+
+ @Override
+ public String policySetDefinitionName() {
+ return this.inner().policySetDefinitionName();
+ }
+
+ @Override
+ public String policySetDefinitionOwner() {
+ return this.inner().policySetDefinitionOwner();
+ }
+
+ @Override
+ public String policySetDefinitionParameters() {
+ return this.inner().policySetDefinitionParameters();
+ }
+
+ @Override
+ public String resourceGroup() {
+ return this.inner().resourceGroup();
+ }
+
+ @Override
+ public String resourceId() {
+ return this.inner().resourceId();
+ }
+
+ @Override
+ public String resourceLocation() {
+ return this.inner().resourceLocation();
+ }
+
+ @Override
+ public String resourceTags() {
+ return this.inner().resourceTags();
+ }
+
+ @Override
+ public String resourceType() {
+ return this.inner().resourceType();
+ }
+
+ @Override
+ public String subscriptionId() {
+ return this.inner().subscriptionId();
+ }
+
+ @Override
+ public DateTime timestamp() {
+ return this.inner().timestamp();
+ }
+
+}
diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java
index 2b650a74467a..5f3e29d72fe1 100644
--- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java
+++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java
@@ -13,7 +13,8 @@
import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates;
import rx.functions.Func1;
import rx.Observable;
-import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesQueryResults;
+import com.microsoft.azure.Page;
+import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyState;
import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.SummarizeResults;
import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesResource;
@@ -30,13 +31,19 @@ public PolicyInsightsManager manager() {
}
@Override
- public Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName) {
+ public Observable listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) {
PolicyStatesInner client = this.inner();
return client.listQueryResultsForManagementGroupAsync(policyStatesResource, managementGroupName)
- .map(new Func1() {
+ .flatMapIterable(new Func1, Iterable>() {
@Override
- public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) {
- return new PolicyStatesQueryResultsImpl(inner, manager());
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
+ @Override
+ public PolicyState call(PolicyStateInner inner) {
+ return new PolicyStateImpl(inner, manager());
}
});
}
@@ -54,13 +61,19 @@ public SummarizeResults call(SummarizeResultsInner inner) {
}
@Override
- public Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId) {
+ public Observable listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId) {
PolicyStatesInner client = this.inner();
return client.listQueryResultsForSubscriptionAsync(policyStatesResource, subscriptionId)
- .map(new Func1() {
+ .flatMapIterable(new Func1, Iterable>() {
+ @Override
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
@Override
- public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) {
- return new PolicyStatesQueryResultsImpl(inner, manager());
+ public PolicyState call(PolicyStateInner inner) {
+ return new PolicyStateImpl(inner, manager());
}
});
}
@@ -78,13 +91,19 @@ public SummarizeResults call(SummarizeResultsInner inner) {
}
@Override
- public Observable listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) {
+ public Observable listQueryResultsForResourceGroupAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName) {
PolicyStatesInner client = this.inner();
return client.listQueryResultsForResourceGroupAsync(policyStatesResource, subscriptionId, resourceGroupName)
- .map(new Func1() {
+ .flatMapIterable(new Func1, Iterable>() {
@Override
- public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) {
- return new PolicyStatesQueryResultsImpl(inner, manager());
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
+ @Override
+ public PolicyState call(PolicyStateInner inner) {
+ return new PolicyStateImpl(inner, manager());
}
});
}
@@ -102,13 +121,19 @@ public SummarizeResults call(SummarizeResultsInner inner) {
}
@Override
- public Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId) {
+ public Observable listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId) {
PolicyStatesInner client = this.inner();
return client.listQueryResultsForResourceAsync(policyStatesResource, resourceId)
- .map(new Func1() {
+ .flatMapIterable(new Func1, Iterable>() {
+ @Override
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
@Override
- public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) {
- return new PolicyStatesQueryResultsImpl(inner, manager());
+ public PolicyState call(PolicyStateInner inner) {
+ return new PolicyStateImpl(inner, manager());
}
});
}
@@ -126,13 +151,19 @@ public SummarizeResults call(SummarizeResultsInner inner) {
}
@Override
- public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) {
+ public Observable listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName) {
PolicyStatesInner client = this.inner();
return client.listQueryResultsForPolicySetDefinitionAsync(policyStatesResource, subscriptionId, policySetDefinitionName)
- .map(new Func1() {
+ .flatMapIterable(new Func1, Iterable>() {
@Override
- public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) {
- return new PolicyStatesQueryResultsImpl(inner, manager());
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
+ @Override
+ public PolicyState call(PolicyStateInner inner) {
+ return new PolicyStateImpl(inner, manager());
}
});
}
@@ -150,13 +181,19 @@ public SummarizeResults call(SummarizeResultsInner inner) {
}
@Override
- public Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) {
+ public Observable listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName) {
PolicyStatesInner client = this.inner();
return client.listQueryResultsForPolicyDefinitionAsync(policyStatesResource, subscriptionId, policyDefinitionName)
- .map(new Func1() {
+ .flatMapIterable(new Func1, Iterable>() {
+ @Override
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
@Override
- public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) {
- return new PolicyStatesQueryResultsImpl(inner, manager());
+ public PolicyState call(PolicyStateInner inner) {
+ return new PolicyStateImpl(inner, manager());
}
});
}
@@ -174,13 +211,19 @@ public SummarizeResults call(SummarizeResultsInner inner) {
}
@Override
- public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) {
+ public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName) {
PolicyStatesInner client = this.inner();
return client.listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(policyStatesResource, subscriptionId, policyAssignmentName)
- .map(new Func1() {
+ .flatMapIterable(new Func1, Iterable>() {
@Override
- public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) {
- return new PolicyStatesQueryResultsImpl(inner, manager());
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
+ @Override
+ public PolicyState call(PolicyStateInner inner) {
+ return new PolicyStateImpl(inner, manager());
}
});
}
@@ -198,13 +241,19 @@ public SummarizeResults call(SummarizeResultsInner inner) {
}
@Override
- public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) {
+ public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) {
PolicyStatesInner client = this.inner();
return client.listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName)
- .map(new Func1() {
+ .flatMapIterable(new Func1, Iterable>() {
+ @Override
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
@Override
- public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) {
- return new PolicyStatesQueryResultsImpl(inner, manager());
+ public PolicyState call(PolicyStateInner inner) {
+ return new PolicyStateImpl(inner, manager());
}
});
}
diff --git a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java
index f52804758294..8103f438d1f6 100644
--- a/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java
+++ b/sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java
@@ -10,14 +10,19 @@
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
+import com.microsoft.azure.AzureServiceFuture;
+import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesResource;
import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryFailureException;
import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryOptions;
+import com.microsoft.azure.Page;
+import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.Validator;
import java.io.IOException;
+import java.util.List;
import okhttp3.ResponseBody;
import org.joda.time.DateTime;
import retrofit2.http.GET;
@@ -26,6 +31,7 @@
import retrofit2.http.Path;
import retrofit2.http.POST;
import retrofit2.http.Query;
+import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
@@ -124,6 +130,38 @@ interface PolicyStatesService {
@GET("{scope}/providers/Microsoft.PolicyInsights/policyStates/$metadata")
Observable> getMetadata(@Path(value = "scope", encoded = true) String scope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForManagementGroupNext" })
+ @GET
+ Observable> listQueryResultsForManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForSubscriptionNext" })
+ @GET
+ Observable> listQueryResultsForSubscriptionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResourceGroupNext" })
+ @GET
+ Observable> listQueryResultsForResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResourceNext" })
+ @GET
+ Observable> listQueryResultsForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForPolicySetDefinitionNext" })
+ @GET
+ Observable> listQueryResultsForPolicySetDefinitionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForPolicyDefinitionNext" })
+ @GET
+ Observable> listQueryResultsForPolicyDefinitionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForSubscriptionLevelPolicyAssignmentNext" })
+ @GET
+ Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForResourceGroupLevelPolicyAssignmentNext" })
+ @GET
+ Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
}
/**
@@ -134,10 +172,16 @@ interface PolicyStatesService {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws QueryFailureException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
- * @return the PolicyStatesQueryResultsInner object if successful.
+ * @return the PagedList<PolicyStateInner> object if successful.
*/
- public PolicyStatesQueryResultsInner listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName) {
- return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).toBlocking().single().body();
+ public PagedList listQueryResultsForManagementGroup(final PolicyStatesResource policyStatesResource, final String managementGroupName) {
+ ServiceResponse> response = listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName).toBlocking().single();
+ return new PagedList(response.body()) {
+ @Override
+ public Page nextPage(String nextPageLink) {
+ return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body();
+ }
+ };
}
/**
@@ -149,8 +193,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForManagementGroup(PolicySt
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
- public ServiceFuture listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, final ServiceCallback serviceCallback) {
- return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName), serviceCallback);
+ public ServiceFuture> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final ListOperationCallback serviceCallback) {
+ return AzureServiceFuture.fromPageResponse(
+ listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName),
+ new Func1>>>() {
+ @Override
+ public Observable>> call(String nextPageLink) {
+ return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink);
+ }
+ },
+ serviceCallback);
}
/**
@@ -159,15 +211,38 @@ public ServiceFuture listQueryResultsForManagemen
* @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
* @param managementGroupName Management group name.
* @throws IllegalArgumentException thrown if parameters fail the validation
- * @return the observable to the PolicyStatesQueryResultsInner object
+ * @return the observable to the PagedList<PolicyStateInner> object
*/
- public Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName) {
- return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).map(new Func1, PolicyStatesQueryResultsInner>() {
- @Override
- public PolicyStatesQueryResultsInner call(ServiceResponse response) {
- return response.body();
- }
- });
+ public Observable> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) {
+ return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName)
+ .map(new Func1>, Page>() {
+ @Override
+ public Page call(ServiceResponse> response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Queries policy states for the resources under the management group.
+ *
+ * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
+ * @param managementGroupName Management group name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the PagedList<PolicyStateInner> object
+ */
+ public Observable>> listQueryResultsForManagementGroupWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) {
+ return listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName)
+ .concatMap(new Func1>, Observable>>>() {
+ @Override
+ public Observable>> call(ServiceResponse> page) {
+ String nextPageLink = page.body().nextPageLink();
+ if (nextPageLink == null) {
+ return Observable.just(page);
+ }
+ return Observable.just(page).concatWith(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink));
+ }
+ });
}
/**
@@ -176,9 +251,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName) {
+ public Observable>> listQueryResultsForManagementGroupSinglePageAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) {
if (policyStatesResource == null) {
throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.");
}
@@ -196,12 +271,12 @@ public Observable> listQueryResul
String filter = null;
String apply = null;
return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent())
- .flatMap(new Func1, Observable>>() {
+ .flatMap(new Func1, Observable>>>() {
@Override
- public Observable> call(Response response) {
+ public Observable>> call(Response response) {
try {
- ServiceResponse clientResponse = listQueryResultsForManagementGroupDelegate(response);
- return Observable.just(clientResponse);
+ ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response);
+ return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
@@ -218,10 +293,16 @@ public Observable> call(Response<
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws QueryFailureException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
- * @return the PolicyStatesQueryResultsInner object if successful.
+ * @return the PagedList<PolicyStateInner> object if successful.
*/
- public PolicyStatesQueryResultsInner listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) {
- return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions).toBlocking().single().body();
+ public PagedList listQueryResultsForManagementGroup(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) {
+ ServiceResponse> response = listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName, queryOptions).toBlocking().single();
+ return new PagedList(response.body()) {
+ @Override
+ public Page nextPage(String nextPageLink) {
+ return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body();
+ }
+ };
}
/**
@@ -234,8 +315,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForManagementGroup(PolicySt
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
- public ServiceFuture listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) {
- return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions), serviceCallback);
+ public ServiceFuture> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) {
+ return AzureServiceFuture.fromPageResponse(
+ listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName, queryOptions),
+ new Func1>>>() {
+ @Override
+ public Observable>> call(String nextPageLink) {
+ return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink);
+ }
+ },
+ serviceCallback);
}
/**
@@ -245,15 +334,16 @@ public ServiceFuture listQueryResultsForManagemen
* @param managementGroupName Management group name.
* @param queryOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
- * @return the observable to the PolicyStatesQueryResultsInner object
+ * @return the observable to the PagedList<PolicyStateInner> object
*/
- public Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) {
- return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() {
- @Override
- public PolicyStatesQueryResultsInner call(ServiceResponse response) {
- return response.body();
- }
- });
+ public Observable> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) {
+ return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions)
+ .map(new Func1>, Page>() {
+ @Override
+ public Page call(ServiceResponse> response) {
+ return response.body();
+ }
+ });
}
/**
@@ -263,9 +353,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForManagementGroupWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) {
+ return listQueryResultsForManagementGroupSinglePageAsync(policyStatesResource, managementGroupName, queryOptions)
+ .concatMap(new Func1>, Observable>>>() {
+ @Override
+ public Observable>> call(ServiceResponse> page) {
+ String nextPageLink = page.body().nextPageLink();
+ if (nextPageLink == null) {
+ return Observable.just(page);
+ }
+ return Observable.just(page).concatWith(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink));
+ }
+ });
+ }
+
+ /**
+ * Queries policy states for the resources under the management group.
+ *
+ ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
+ ServiceResponse> * @param managementGroupName Management group name.
+ ServiceResponse> * @param queryOptions Additional parameters for the operation
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful.
*/
- public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) {
+ public Observable>> listQueryResultsForManagementGroupSinglePageAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) {
if (policyStatesResource == null) {
throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.");
}
@@ -304,12 +417,12 @@ public Observable> listQueryResul
apply = queryOptions.apply();
}
return service.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent())
- .flatMap(new Func1, Observable>>() {
+ .flatMap(new Func1, Observable>>>() {
@Override
- public Observable> call(Response response) {
+ public Observable>> call(Response response) {
try {
- ServiceResponse clientResponse = listQueryResultsForManagementGroupDelegate(response);
- return Observable.just(clientResponse);
+ ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response);
+ return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
@@ -317,9 +430,9 @@ public Observable> call(Response<
});
}
- private ServiceResponse listQueryResultsForManagementGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException {
- return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
- .register(200, new TypeToken() { }.getType())
+ private ServiceResponse> listQueryResultsForManagementGroupDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException {
+ return this.client.restClient().responseBuilderFactory()., QueryFailureException>newInstance(this.client.serializerAdapter())
+ .register(200, new TypeToken>() { }.getType())
.registerError(QueryFailureException.class)
.build(response);
}
@@ -503,10 +616,16 @@ private ServiceResponse summarizeForManagementGroupDelega
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws QueryFailureException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
- * @return the PolicyStatesQueryResultsInner object if successful.
+ * @return the PagedList<PolicyStateInner> object if successful.
*/
- public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId) {
- return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId).toBlocking().single().body();
+ public PagedList listQueryResultsForSubscription(final PolicyStatesResource policyStatesResource, final String subscriptionId) {
+ ServiceResponse> response = listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId).toBlocking().single();
+ return new PagedList(response.body()) {
+ @Override
+ public Page nextPage(String nextPageLink) {
+ return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body();
+ }
+ };
}
/**
@@ -518,8 +637,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyState
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
- public ServiceFuture listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, final ServiceCallback serviceCallback) {
- return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId), serviceCallback);
+ public ServiceFuture> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final ListOperationCallback serviceCallback) {
+ return AzureServiceFuture.fromPageResponse(
+ listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId),
+ new Func1>>>() {
+ @Override
+ public Observable>> call(String nextPageLink) {
+ return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink);
+ }
+ },
+ serviceCallback);
}
/**
@@ -528,15 +655,38 @@ public ServiceFuture listQueryResultsForSubscript
* @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
* @param subscriptionId Microsoft Azure subscription ID.
* @throws IllegalArgumentException thrown if parameters fail the validation
- * @return the observable to the PolicyStatesQueryResultsInner object
+ * @return the observable to the PagedList<PolicyStateInner> object
*/
- public Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId) {
- return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId).map(new Func1, PolicyStatesQueryResultsInner>() {
- @Override
- public PolicyStatesQueryResultsInner call(ServiceResponse response) {
- return response.body();
- }
- });
+ public Observable> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId) {
+ return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId)
+ .map(new Func1>, Page>() {
+ @Override
+ public Page call(ServiceResponse> response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Queries policy states for the resources under the subscription.
+ *
+ * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
+ * @param subscriptionId Microsoft Azure subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the PagedList<PolicyStateInner> object
+ */
+ public Observable>> listQueryResultsForSubscriptionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId) {
+ return listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId)
+ .concatMap(new Func1>, Observable>>>() {
+ @Override
+ public Observable>> call(ServiceResponse> page) {
+ String nextPageLink = page.body().nextPageLink();
+ if (nextPageLink == null) {
+ return Observable.just(page);
+ }
+ return Observable.just(page).concatWith(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink));
+ }
+ });
}
/**
@@ -545,9 +695,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId) {
+ public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId) {
if (policyStatesResource == null) {
throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.");
}
@@ -564,12 +714,12 @@ public Observable> listQueryResul
String filter = null;
String apply = null;
return service.listQueryResultsForSubscription(policyStatesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent())
- .flatMap(new Func1, Observable>>() {
+ .flatMap(new Func1, Observable>>>() {
@Override
- public Observable> call(Response response) {
+ public Observable>> call(Response response) {
try {
- ServiceResponse clientResponse = listQueryResultsForSubscriptionDelegate(response);
- return Observable.just(clientResponse);
+ ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response);
+ return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
@@ -586,10 +736,16 @@ public Observable> call(Response<
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws QueryFailureException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
- * @return the PolicyStatesQueryResultsInner object if successful.
+ * @return the PagedList<PolicyStateInner> object if successful.
*/
- public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) {
- return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions).toBlocking().single().body();
+ public PagedList listQueryResultsForSubscription(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) {
+ ServiceResponse> response = listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId, queryOptions).toBlocking().single();
+ return new PagedList(response.body()) {
+ @Override
+ public Page nextPage(String nextPageLink) {
+ return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body();
+ }
+ };
}
/**
@@ -602,8 +758,16 @@ public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyState
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
- public ServiceFuture listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) {
- return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions), serviceCallback);
+ public ServiceFuture> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) {
+ return AzureServiceFuture.fromPageResponse(
+ listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId, queryOptions),
+ new Func1>>>() {
+ @Override
+ public Observable>> call(String nextPageLink) {
+ return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink);
+ }
+ },
+ serviceCallback);
}
/**
@@ -613,15 +777,16 @@ public ServiceFuture listQueryResultsForSubscript
* @param subscriptionId Microsoft Azure subscription ID.
* @param queryOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
- * @return the observable to the PolicyStatesQueryResultsInner object
+ * @return the observable to the PagedList<PolicyStateInner> object
*/
- public Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) {
- return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() {
- @Override
- public PolicyStatesQueryResultsInner call(ServiceResponse response) {
- return response.body();
- }
- });
+ public Observable> listQueryResultsForSubscriptionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) {
+ return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions)
+ .map(new Func1>, Page>() {
+ @Override
+ public Page call(ServiceResponse> response) {
+ return response.body();
+ }
+ });
}
/**
@@ -631,9 +796,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) {
+ return listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId, queryOptions)
+ .concatMap(new Func1>, Observable