diff --git a/sdk/policyinsights/mgmt-v2019_10_01/pom.xml b/sdk/policyinsights/mgmt-v2019_10_01/pom.xml index 1b09c2954250..025cea421db0 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/pom.xml +++ b/sdk/policyinsights/mgmt-v2019_10_01/pom.xml @@ -12,7 +12,7 @@ com.microsoft.azure azure-arm-parent 1.1.0 - ../../parents/azure-arm-parent + ../../../pom.management.xml azure-mgmt-policyinsights 1.0.0-beta diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Attestation.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Attestation.java new file mode 100644 index 000000000000..38bf8e8dbdad --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Attestation.java @@ -0,0 +1,306 @@ +/** + * 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.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policyinsights.v2019_10_01.implementation.AttestationInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2019_10_01.implementation.PolicyInsightsManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing Attestation. + */ +public interface Attestation extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the comments value. + */ + String comments(); + + /** + * @return the complianceState value. + */ + ComplianceState complianceState(); + + /** + * @return the evidence value. + */ + List evidence(); + + /** + * @return the expiresOn value. + */ + DateTime expiresOn(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastComplianceStateChangeAt value. + */ + DateTime lastComplianceStateChangeAt(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the owner value. + */ + String owner(); + + /** + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the systemData value. + */ + SystemData systemData(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Attestation definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithSubscriptionId, DefinitionStages.WithResourceGroupName, DefinitionStages.WithPolicyAssignmentId, DefinitionStages.WithCreate { + } + + /** + * Grouping of Attestation definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Attestation definition. + */ + interface Blank extends WithSubscriptionId { + } + + /** + * The stage of the attestation definition allowing to specify SubscriptionId. + */ + interface WithSubscriptionId { + /** + * Specifies subscriptionId. + * @param subscriptionId The ID of the target subscription + * @return the next definition stage + */ + WithResourceGroupName withSubscriptionId(String subscriptionId); + } + + /** + * The stage of the attestation definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group. The name is case insensitive + * @return the next definition stage + */ + WithPolicyAssignmentId withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the attestation definition allowing to specify PolicyAssignmentId. + */ + interface WithPolicyAssignmentId { + /** + * Specifies policyAssignmentId. + * @param policyAssignmentId The resource ID of the policy assignment that the attestation is setting the state for + * @return the next definition stage + */ + WithCreate withPolicyAssignmentId(String policyAssignmentId); + } + + /** + * The stage of the attestation definition allowing to specify Comments. + */ + interface WithComments { + /** + * Specifies comments. + * @param comments Comments describing why this attestation was created + * @return the next definition stage + */ + WithCreate withComments(String comments); + } + + /** + * The stage of the attestation definition allowing to specify ComplianceState. + */ + interface WithComplianceState { + /** + * Specifies complianceState. + * @param complianceState The compliance state that should be set on the resource. Possible values include: 'Compliant', 'NonCompliant', 'Unknown' + * @return the next definition stage + */ + WithCreate withComplianceState(ComplianceState complianceState); + } + + /** + * The stage of the attestation definition allowing to specify Evidence. + */ + interface WithEvidence { + /** + * Specifies evidence. + * @param evidence The evidence supporting the compliance state set in this attestation + * @return the next definition stage + */ + WithCreate withEvidence(List evidence); + } + + /** + * The stage of the attestation definition allowing to specify ExpiresOn. + */ + interface WithExpiresOn { + /** + * Specifies expiresOn. + * @param expiresOn The time the compliance state should expire + * @return the next definition stage + */ + WithCreate withExpiresOn(DateTime expiresOn); + } + + /** + * The stage of the attestation definition allowing to specify Owner. + */ + interface WithOwner { + /** + * Specifies owner. + * @param owner The person responsible for setting the state of the resource. This value is typically an Azure Active Directory object ID + * @return the next definition stage + */ + WithCreate withOwner(String owner); + } + + /** + * The stage of the attestation definition allowing to specify PolicyDefinitionReferenceId. + */ + interface WithPolicyDefinitionReferenceId { + /** + * Specifies policyDefinitionReferenceId. + * @param policyDefinitionReferenceId The policy definition reference ID from a policy set definition that the attestation is setting the state for. If the policy assignment assigns a policy set definition the attestation can choose a definition within the set definition with this property or omit this and set the state for the entire set definition + * @return the next definition stage + */ + WithCreate withPolicyDefinitionReferenceId(String policyDefinitionReferenceId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithComments, DefinitionStages.WithComplianceState, DefinitionStages.WithEvidence, DefinitionStages.WithExpiresOn, DefinitionStages.WithOwner, DefinitionStages.WithPolicyDefinitionReferenceId { + } + } + /** + * The template for a Attestation update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithComments, UpdateStages.WithComplianceState, UpdateStages.WithEvidence, UpdateStages.WithExpiresOn, UpdateStages.WithOwner, UpdateStages.WithPolicyDefinitionReferenceId { + } + + /** + * Grouping of Attestation update stages. + */ + interface UpdateStages { + /** + * The stage of the attestation update allowing to specify Comments. + */ + interface WithComments { + /** + * Specifies comments. + * @param comments Comments describing why this attestation was created + * @return the next update stage + */ + Update withComments(String comments); + } + + /** + * The stage of the attestation update allowing to specify ComplianceState. + */ + interface WithComplianceState { + /** + * Specifies complianceState. + * @param complianceState The compliance state that should be set on the resource. Possible values include: 'Compliant', 'NonCompliant', 'Unknown' + * @return the next update stage + */ + Update withComplianceState(ComplianceState complianceState); + } + + /** + * The stage of the attestation update allowing to specify Evidence. + */ + interface WithEvidence { + /** + * Specifies evidence. + * @param evidence The evidence supporting the compliance state set in this attestation + * @return the next update stage + */ + Update withEvidence(List evidence); + } + + /** + * The stage of the attestation update allowing to specify ExpiresOn. + */ + interface WithExpiresOn { + /** + * Specifies expiresOn. + * @param expiresOn The time the compliance state should expire + * @return the next update stage + */ + Update withExpiresOn(DateTime expiresOn); + } + + /** + * The stage of the attestation update allowing to specify Owner. + */ + interface WithOwner { + /** + * Specifies owner. + * @param owner The person responsible for setting the state of the resource. This value is typically an Azure Active Directory object ID + * @return the next update stage + */ + Update withOwner(String owner); + } + + /** + * The stage of the attestation update allowing to specify PolicyDefinitionReferenceId. + */ + interface WithPolicyDefinitionReferenceId { + /** + * Specifies policyDefinitionReferenceId. + * @param policyDefinitionReferenceId The policy definition reference ID from a policy set definition that the attestation is setting the state for. If the policy assignment assigns a policy set definition the attestation can choose a definition within the set definition with this property or omit this and set the state for the entire set definition + * @return the next update stage + */ + Update withPolicyDefinitionReferenceId(String policyDefinitionReferenceId); + } + + } +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/AttestationEvidence.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/AttestationEvidence.java new file mode 100644 index 000000000000..4e70bc1d7ebf --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/AttestationEvidence.java @@ -0,0 +1,69 @@ +/** + * 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.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A piece of evidence supporting the compliance state set in the attestation. + */ +public class AttestationEvidence { + /** + * The description for this piece of evidence. + */ + @JsonProperty(value = "description") + private String description; + + /** + * The URI location of the evidence. + */ + @JsonProperty(value = "sourceUri") + private String sourceUri; + + /** + * Get the description for this piece of evidence. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description for this piece of evidence. + * + * @param description the description value to set + * @return the AttestationEvidence object itself. + */ + public AttestationEvidence withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the URI location of the evidence. + * + * @return the sourceUri value + */ + public String sourceUri() { + return this.sourceUri; + } + + /** + * Set the URI location of the evidence. + * + * @param sourceUri the sourceUri value to set + * @return the AttestationEvidence object itself. + */ + public AttestationEvidence withSourceUri(String sourceUri) { + this.sourceUri = sourceUri; + return this; + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Attestations.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Attestations.java new file mode 100644 index 000000000000..f91ea6cd51e6 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Attestations.java @@ -0,0 +1,134 @@ +/** + * 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.v2019_10_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policyinsights.v2019_10_01.implementation.AttestationInner; +import com.microsoft.azure.management.policyinsights.v2019_10_01.implementation.AttestationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Attestations. + */ +public interface Attestations extends SupportsCreating, HasInner { + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtSubscriptionAsync(String subscriptionId, String attestationName, AttestationInner parameters); + + /** + * Gets an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtSubscriptionAsync(String subscriptionId, String attestationName); + + /** + * Deletes an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtSubscriptionAsync(String subscriptionId, String attestationName); + + /** + * Gets an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName); + + /** + * Deletes an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName); + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtResourceAsync(String resourceId, String attestationName, AttestationInner parameters); + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtResourceAsync(String resourceId, String attestationName); + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtResourceAsync(String resourceId, String attestationName); + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String subscriptionId); + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String subscriptionId, final String resourceGroupName); + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForResourceAsync(final String resourceId); + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/AzureEntityResource.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/AzureEntityResource.java new file mode 100644 index 000000000000..396567212b6f --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/AzureEntityResource.java @@ -0,0 +1,34 @@ +/** + * 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.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * The resource model definition for a Azure Resource Manager resource with an + * etag. + */ +public class AzureEntityResource extends ProxyResource { + /** + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get resource Etag. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComplianceState.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComplianceState.java new file mode 100644 index 000000000000..9434121cb446 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComplianceState.java @@ -0,0 +1,44 @@ +/** + * 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.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ComplianceState. + */ +public final class ComplianceState extends ExpandableStringEnum { + /** Static value Compliant for ComplianceState. */ + public static final ComplianceState COMPLIANT = fromString("Compliant"); + + /** Static value NonCompliant for ComplianceState. */ + public static final ComplianceState NON_COMPLIANT = fromString("NonCompliant"); + + /** Static value Unknown for ComplianceState. */ + public static final ComplianceState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a ComplianceState from its string representation. + * @param name a name to look for + * @return the corresponding ComplianceState + */ + @JsonCreator + public static ComplianceState fromString(String name) { + return fromString(name, ComplianceState.class); + } + + /** + * @return known ComplianceState values + */ + public static Collection values() { + return values(ComplianceState.class); + } +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComponentEventDetails.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComponentEventDetails.java new file mode 100644 index 000000000000..e6863e8515f0 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComponentEventDetails.java @@ -0,0 +1,228 @@ +/** + * 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.v2019_10_01; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Component event details. + */ +public class ComponentEventDetails { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Component Id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Component type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Component name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Timestamp for component policy event record. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Tenant ID for the policy event record. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Principal object ID for the user who initiated the resource component + * operation that triggered the policy event. + */ + @JsonProperty(value = "principalOid") + private String principalOid; + + /** + * Policy definition action, i.e. effect. + */ + @JsonProperty(value = "policyDefinitionAction") + private String policyDefinitionAction; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get component Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set component Id. + * + * @param id the id value to set + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withId(String id) { + this.id = id; + return this; + } + + /** + * Get component type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set component type. + * + * @param type the type value to set + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withType(String type) { + this.type = type; + return this; + } + + /** + * Get component name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set component name. + * + * @param name the name value to set + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get timestamp for component policy event record. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set timestamp for component policy event record. + * + * @param timestamp the timestamp value to set + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get tenant ID for the policy event record. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set tenant ID for the policy event record. + * + * @param tenantId the tenantId value to set + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get principal object ID for the user who initiated the resource component operation that triggered the policy event. + * + * @return the principalOid value + */ + public String principalOid() { + return this.principalOid; + } + + /** + * Set principal object ID for the user who initiated the resource component operation that triggered the policy event. + * + * @param principalOid the principalOid value to set + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withPrincipalOid(String principalOid) { + this.principalOid = principalOid; + return this; + } + + /** + * Get policy definition action, i.e. effect. + * + * @return the policyDefinitionAction value + */ + public String policyDefinitionAction() { + return this.policyDefinitionAction; + } + + /** + * Set policy definition action, i.e. effect. + * + * @param policyDefinitionAction the policyDefinitionAction value to set + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withPolicyDefinitionAction(String policyDefinitionAction) { + this.policyDefinitionAction = policyDefinitionAction; + return this; + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComponentStateDetails.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComponentStateDetails.java new file mode 100644 index 000000000000..c85a7ea16103 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/ComponentStateDetails.java @@ -0,0 +1,175 @@ +/** + * 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.v2019_10_01; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Component state details. + */ +public class ComponentStateDetails { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Component Id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Component type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Component name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Component compliance evaluation timestamp. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Component compliance state. + */ + @JsonProperty(value = "complianceState") + private String complianceState; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get component Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set component Id. + * + * @param id the id value to set + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withId(String id) { + this.id = id; + return this; + } + + /** + * Get component type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set component type. + * + * @param type the type value to set + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withType(String type) { + this.type = type; + return this; + } + + /** + * Get component name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set component name. + * + * @param name the name value to set + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get component compliance evaluation timestamp. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set component compliance evaluation timestamp. + * + * @param timestamp the timestamp value to set + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get component compliance state. + * + * @return the complianceState value + */ + public String complianceState() { + return this.complianceState; + } + + /** + * Set component compliance state. + * + * @param complianceState the complianceState value to set + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withComplianceState(String complianceState) { + this.complianceState = complianceState; + return this; + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/CreatedByType.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/CreatedByType.java new file mode 100644 index 000000000000..5809f9bf1d2b --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/CreatedByType.java @@ -0,0 +1,47 @@ +/** + * 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.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CreatedByType. + */ +public final class CreatedByType extends ExpandableStringEnum { + /** Static value User for CreatedByType. */ + public static final CreatedByType USER = fromString("User"); + + /** Static value Application for CreatedByType. */ + public static final CreatedByType APPLICATION = fromString("Application"); + + /** Static value ManagedIdentity for CreatedByType. */ + public static final CreatedByType MANAGED_IDENTITY = fromString("ManagedIdentity"); + + /** Static value Key for CreatedByType. */ + public static final CreatedByType KEY = fromString("Key"); + + /** + * Creates or finds a CreatedByType from its string representation. + * @param name a name to look for + * @return the corresponding CreatedByType + */ + @JsonCreator + public static CreatedByType fromString(String name) { + return fromString(name, CreatedByType.class); + } + + /** + * @return known CreatedByType values + */ + public static Collection values() { + return values(CreatedByType.class); + } +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyEvent.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyEvent.java new file mode 100644 index 000000000000..87049467a64a --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyEvent.java @@ -0,0 +1,183 @@ +/** + * 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.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2019_10_01.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2019_10_01.implementation.PolicyEventInner; +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing PolicyEvent. + */ +public interface PolicyEvent extends HasInner, HasManager { + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the complianceState value. + */ + String complianceState(); + + /** + * @return the components value. + */ + List components(); + + /** + * @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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyEvents.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyEvents.java index 1d788d1cddad..2198ba63a4bc 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyEvents.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyState.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyState.java new file mode 100644 index 000000000000..0f50580abc7f --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyState.java @@ -0,0 +1,198 @@ +/** + * 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.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2019_10_01.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2019_10_01.implementation.PolicyStateInner; +import java.util.Map; +import java.util.List; +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 components value. + */ + List components(); + + /** + * @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 policyAssignmentVersion value. + */ + String policyAssignmentVersion(); + + /** + * @return the policyDefinitionAction value. + */ + String policyDefinitionAction(); + + /** + * @return the policyDefinitionCategory value. + */ + String policyDefinitionCategory(); + + /** + * @return the policyDefinitionGroupNames value. + */ + List policyDefinitionGroupNames(); + + /** + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * @return the policyDefinitionName value. + */ + String policyDefinitionName(); + + /** + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * @return the policyDefinitionVersion value. + */ + String policyDefinitionVersion(); + + /** + * @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 policySetDefinitionVersion value. + */ + String policySetDefinitionVersion(); + + /** + * @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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyStates.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyStates.java index 91c835ae3b6f..916ddac40338 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyStates.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/PolicyStates.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.policyinsights.v2019_10_01; +import rx.Completable; import rx.Observable; /** @@ -22,7 +23,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 +42,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 +62,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 +82,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. @@ -92,6 +93,25 @@ public interface PolicyStates { */ Observable summarizeForResourceAsync(String resourceId); + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable triggerSubscriptionEvaluationAsync(String subscriptionId); + + /** + * Triggers a policy evaluation scan for all 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 for the request + */ + Completable triggerResourceGroupEvaluationAsync(String subscriptionId, String resourceGroupName); + /** * Queries policy states for the subscription level policy set definition. * @@ -101,7 +121,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 +142,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 +163,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 +185,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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/QueryOptions.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/QueryOptions.java index 5289127854c7..caeccbd74410 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/QueryOptions.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/QueryOptions.java @@ -64,8 +64,15 @@ public class QueryOptions { private String apply; /** - * The $expand query parameter. For example, to expand - * policyEvaluationDetails, use $expand=policyEvaluationDetails. + * 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 components use + * $expand=components. */ @JsonProperty(value = "") private String expand; @@ -211,7 +218,27 @@ public QueryOptions withApply(String apply) { } /** - * Get the $expand query parameter. For example, to expand policyEvaluationDetails, use $expand=policyEvaluationDetails. + * 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 components use $expand=components. * * @return the expand value */ @@ -220,7 +247,7 @@ public String expand() { } /** - * Set the $expand query parameter. For example, to expand policyEvaluationDetails, use $expand=policyEvaluationDetails. + * Set the $expand query parameter. For example, to expand components use $expand=components. * * @param expand the expand value to set * @return the QueryOptions object itself. diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Remediation.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Remediation.java index 2cb39df9700f..11e7d513d28f 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Remediation.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/Remediation.java @@ -80,7 +80,7 @@ public interface Remediation extends HasInner, Indexable, Upda /** * The entirety of the Remediation definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagementGroupId, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithMicrosoft.PolicyInsight, DefinitionStages.WithCreate { } /** @@ -90,19 +90,19 @@ interface DefinitionStages { /** * The first stage of a Remediation definition. */ - interface Blank extends WithManagementGroupId { + interface Blank extends WithMicrosoft.PolicyInsight { } /** - * The stage of the remediation definition allowing to specify ManagementGroupId. + * The stage of the remediation definition allowing to specify Microsoft.PolicyInsight. */ - interface WithManagementGroupId { + interface WithMicrosoft.PolicyInsight { /** * Specifies managementGroupId. * @param managementGroupId Management group ID * @return the next definition stage */ - WithCreate withExistingManagementGroupId(String managementGroupId); + WithCreate withExistingMicrosoft.PolicyInsight(String managementGroupId); } /** diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/SystemData.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/SystemData.java new file mode 100644 index 000000000000..43a0c1e01800 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/SystemData.java @@ -0,0 +1,176 @@ +/** + * 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.v2019_10_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metadata pertaining to creation and last modification of the resource. + */ +public class SystemData { + /** + * The identity that created the resource. + */ + @JsonProperty(value = "createdBy") + private String createdBy; + + /** + * The type of identity that created the resource. Possible values include: + * 'User', 'Application', 'ManagedIdentity', 'Key'. + */ + @JsonProperty(value = "createdByType") + private CreatedByType createdByType; + + /** + * The timestamp of resource creation (UTC). + */ + @JsonProperty(value = "createdAt") + private DateTime createdAt; + + /** + * The identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedBy") + private String lastModifiedBy; + + /** + * The type of identity that last modified the resource. Possible values + * include: 'User', 'Application', 'ManagedIdentity', 'Key'. + */ + @JsonProperty(value = "lastModifiedByType") + private CreatedByType lastModifiedByType; + + /** + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedAt") + private DateTime lastModifiedAt; + + /** + * Get the identity that created the resource. + * + * @return the createdBy value + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Set the identity that created the resource. + * + * @param createdBy the createdBy value to set + * @return the SystemData object itself. + */ + public SystemData withCreatedBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key'. + * + * @return the createdByType value + */ + public CreatedByType createdByType() { + return this.createdByType; + } + + /** + * Set the type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key'. + * + * @param createdByType the createdByType value to set + * @return the SystemData object itself. + */ + public SystemData withCreatedByType(CreatedByType createdByType) { + this.createdByType = createdByType; + return this; + } + + /** + * Get the timestamp of resource creation (UTC). + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Set the timestamp of resource creation (UTC). + * + * @param createdAt the createdAt value to set + * @return the SystemData object itself. + */ + public SystemData withCreatedAt(DateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the identity that last modified the resource. + * + * @return the lastModifiedBy value + */ + public String lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Set the identity that last modified the resource. + * + * @param lastModifiedBy the lastModifiedBy value to set + * @return the SystemData object itself. + */ + public SystemData withLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * Get the type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key'. + * + * @return the lastModifiedByType value + */ + public CreatedByType lastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Set the type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key'. + * + * @param lastModifiedByType the lastModifiedByType value to set + * @return the SystemData object itself. + */ + public SystemData withLastModifiedByType(CreatedByType lastModifiedByType) { + this.lastModifiedByType = lastModifiedByType; + return this; + } + + /** + * Get the type of identity that last modified the resource. + * + * @return the lastModifiedAt value + */ + public DateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Set the type of identity that last modified the resource. + * + * @param lastModifiedAt the lastModifiedAt value to set + * @return the SystemData object itself. + */ + public SystemData withLastModifiedAt(DateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + return this; + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationImpl.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationImpl.java new file mode 100644 index 000000000000..4bc63e666794 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationImpl.java @@ -0,0 +1,197 @@ +/** + * 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.v2019_10_01.implementation; + +import com.microsoft.azure.management.policyinsights.v2019_10_01.Attestation; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.policyinsights.v2019_10_01.ComplianceState; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.policyinsights.v2019_10_01.AttestationEvidence; +import com.microsoft.azure.management.policyinsights.v2019_10_01.SystemData; + +class AttestationImpl extends CreatableUpdatableImpl implements Attestation, Attestation.Definition, Attestation.Update { + private String subscriptionId; + private String resourceGroupName; + private String attestationName; + private final PolicyInsightsManager manager; + + AttestationImpl(String name, PolicyInsightsManager manager) { + super(name, new AttestationInner()); + this.manager = manager; + // Set resource name + this.attestationName = name; + // + } + + AttestationImpl(AttestationInner inner, PolicyInsightsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.attestationName = inner.name(); + // set resource ancestor and positional variables + this.subscriptionId = IdParsingUtils.getValueFromIdByName(inner.id(), "subscriptions"); + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.attestationName = IdParsingUtils.getValueFromIdByName(inner.id(), "attestations"); + // set other parameters for create and update + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + AttestationsInner client = this.manager().inner().attestations(); + return client.createOrUpdateAtResourceGroupAsync(this.subscriptionId, this.resourceGroupName, this.attestationName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + AttestationsInner client = this.manager().inner().attestations(); + return client.createOrUpdateAtResourceGroupAsync(this.subscriptionId, this.resourceGroupName, this.attestationName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + AttestationsInner client = this.manager().inner().attestations(); + return client.getAtResourceAsync(this.subscriptionId, this.resourceGroupName, this.attestationName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String comments() { + return this.inner().comments(); + } + + @Override + public ComplianceState complianceState() { + return this.inner().complianceState(); + } + + @Override + public List evidence() { + return this.inner().evidence(); + } + + @Override + public DateTime expiresOn() { + return this.inner().expiresOn(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastComplianceStateChangeAt() { + return this.inner().lastComplianceStateChangeAt(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String owner() { + return this.inner().owner(); + } + + @Override + public String policyAssignmentId() { + return this.inner().policyAssignmentId(); + } + + @Override + public String policyDefinitionReferenceId() { + return this.inner().policyDefinitionReferenceId(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public SystemData systemData() { + return this.inner().systemData(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public AttestationImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + @Override + public AttestationImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public AttestationImpl withPolicyAssignmentId(String policyAssignmentId) { + this.inner().withPolicyAssignmentId(policyAssignmentId); + return this; + } + + @Override + public AttestationImpl withComments(String comments) { + this.inner().withComments(comments); + return this; + } + + @Override + public AttestationImpl withComplianceState(ComplianceState complianceState) { + this.inner().withComplianceState(complianceState); + return this; + } + + @Override + public AttestationImpl withEvidence(List evidence) { + this.inner().withEvidence(evidence); + return this; + } + + @Override + public AttestationImpl withExpiresOn(DateTime expiresOn) { + this.inner().withExpiresOn(expiresOn); + return this; + } + + @Override + public AttestationImpl withOwner(String owner) { + this.inner().withOwner(owner); + return this; + } + + @Override + public AttestationImpl withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.inner().withPolicyDefinitionReferenceId(policyDefinitionReferenceId); + return this; + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationInner.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationInner.java new file mode 100644 index 000000000000..7972edef20b3 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationInner.java @@ -0,0 +1,260 @@ +/** + * 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.v2019_10_01.implementation; + +import com.microsoft.azure.management.policyinsights.v2019_10_01.ComplianceState; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.policyinsights.v2019_10_01.AttestationEvidence; +import com.microsoft.azure.management.policyinsights.v2019_10_01.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An attestation resource. + */ +@JsonFlatten +public class AttestationInner extends ProxyResource { + /** + * The resource ID of the policy assignment that the attestation is setting + * the state for. + */ + @JsonProperty(value = "properties.policyAssignmentId", required = true) + private String policyAssignmentId; + + /** + * The policy definition reference ID from a policy set definition that the + * attestation is setting the state for. If the policy assignment assigns a + * policy set definition the attestation can choose a definition within the + * set definition with this property or omit this and set the state for the + * entire set definition. + */ + @JsonProperty(value = "properties.policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * The compliance state that should be set on the resource. Possible values + * include: 'Compliant', 'NonCompliant', 'Unknown'. + */ + @JsonProperty(value = "properties.complianceState") + private ComplianceState complianceState; + + /** + * The time the compliance state should expire. + */ + @JsonProperty(value = "properties.expiresOn") + private DateTime expiresOn; + + /** + * The person responsible for setting the state of the resource. This value + * is typically an Azure Active Directory object ID. + */ + @JsonProperty(value = "properties.owner") + private String owner; + + /** + * Comments describing why this attestation was created. + */ + @JsonProperty(value = "properties.comments") + private String comments; + + /** + * The evidence supporting the compliance state set in this attestation. + */ + @JsonProperty(value = "properties.evidence") + private List evidence; + + /** + * The status of the attestation. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The time the compliance state was last changed in this attestation. + */ + @JsonProperty(value = "properties.lastComplianceStateChangeAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastComplianceStateChangeAt; + + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the resource ID of the policy assignment that the attestation is setting the state for. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set the resource ID of the policy assignment that the attestation is setting the state for. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the AttestationInner object itself. + */ + public AttestationInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get the policy definition reference ID from a policy set definition that the attestation is setting the state for. If the policy assignment assigns a policy set definition the attestation can choose a definition within the set definition with this property or omit this and set the state for the entire set definition. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set the policy definition reference ID from a policy set definition that the attestation is setting the state for. If the policy assignment assigns a policy set definition the attestation can choose a definition within the set definition with this property or omit this and set the state for the entire set definition. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the AttestationInner object itself. + */ + public AttestationInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the compliance state that should be set on the resource. Possible values include: 'Compliant', 'NonCompliant', 'Unknown'. + * + * @return the complianceState value + */ + public ComplianceState complianceState() { + return this.complianceState; + } + + /** + * Set the compliance state that should be set on the resource. Possible values include: 'Compliant', 'NonCompliant', 'Unknown'. + * + * @param complianceState the complianceState value to set + * @return the AttestationInner object itself. + */ + public AttestationInner withComplianceState(ComplianceState complianceState) { + this.complianceState = complianceState; + return this; + } + + /** + * Get the time the compliance state should expire. + * + * @return the expiresOn value + */ + public DateTime expiresOn() { + return this.expiresOn; + } + + /** + * Set the time the compliance state should expire. + * + * @param expiresOn the expiresOn value to set + * @return the AttestationInner object itself. + */ + public AttestationInner withExpiresOn(DateTime expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Get the person responsible for setting the state of the resource. This value is typically an Azure Active Directory object ID. + * + * @return the owner value + */ + public String owner() { + return this.owner; + } + + /** + * Set the person responsible for setting the state of the resource. This value is typically an Azure Active Directory object ID. + * + * @param owner the owner value to set + * @return the AttestationInner object itself. + */ + public AttestationInner withOwner(String owner) { + this.owner = owner; + return this; + } + + /** + * Get comments describing why this attestation was created. + * + * @return the comments value + */ + public String comments() { + return this.comments; + } + + /** + * Set comments describing why this attestation was created. + * + * @param comments the comments value to set + * @return the AttestationInner object itself. + */ + public AttestationInner withComments(String comments) { + this.comments = comments; + return this; + } + + /** + * Get the evidence supporting the compliance state set in this attestation. + * + * @return the evidence value + */ + public List evidence() { + return this.evidence; + } + + /** + * Set the evidence supporting the compliance state set in this attestation. + * + * @param evidence the evidence value to set + * @return the AttestationInner object itself. + */ + public AttestationInner withEvidence(List evidence) { + this.evidence = evidence; + return this; + } + + /** + * Get the status of the attestation. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the time the compliance state was last changed in this attestation. + * + * @return the lastComplianceStateChangeAt value + */ + public DateTime lastComplianceStateChangeAt() { + return this.lastComplianceStateChangeAt; + } + + /** + * Get azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value + */ + public SystemData systemData() { + return this.systemData; + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationsImpl.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationsImpl.java new file mode 100644 index 000000000000..757703ce3743 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationsImpl.java @@ -0,0 +1,177 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.policyinsights.v2019_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policyinsights.v2019_10_01.Attestations; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policyinsights.v2019_10_01.Attestation; + +class AttestationsImpl extends WrapperImpl implements Attestations { + private final PolicyInsightsManager manager; + + AttestationsImpl(PolicyInsightsManager manager) { + super(manager.inner().attestations()); + this.manager = manager; + } + + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public AttestationImpl define(String name) { + return wrapModel(name); + } + + private AttestationImpl wrapModel(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + + private AttestationImpl wrapModel(String name) { + return new AttestationImpl(name, this.manager()); + } + + @Override + public Observable createOrUpdateAtSubscriptionAsync(String subscriptionId, String attestationName, AttestationInner parameters) { + AttestationsInner client = this.inner(); + return client.createOrUpdateAtSubscriptionAsync(subscriptionId, attestationName, parameters) + .map(new Func1() { + @Override + public Attestation call(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtSubscriptionAsync(String subscriptionId, String attestationName) { + AttestationsInner client = this.inner(); + return client.getAtSubscriptionAsync(subscriptionId, attestationName) + .map(new Func1() { + @Override + public Attestation call(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtSubscriptionAsync(String subscriptionId, String attestationName) { + AttestationsInner client = this.inner(); + return client.deleteAtSubscriptionAsync(subscriptionId, attestationName).toCompletable(); + } + + @Override + public Observable getByResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName) { + AttestationsInner client = this.inner(); + return client.getByResourceGroupAsync(subscriptionId, resourceGroupName, attestationName) + .map(new Func1() { + @Override + public Attestation call(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName) { + AttestationsInner client = this.inner(); + return client.deleteAtResourceGroupAsync(subscriptionId, resourceGroupName, attestationName).toCompletable(); + } + + @Override + public Observable createOrUpdateAtResourceAsync(String resourceId, String attestationName, AttestationInner parameters) { + AttestationsInner client = this.inner(); + return client.createOrUpdateAtResourceAsync(resourceId, attestationName, parameters) + .map(new Func1() { + @Override + public Attestation call(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtResourceAsync(String resourceId, String attestationName) { + AttestationsInner client = this.inner(); + return client.getAtResourceAsync(resourceId, attestationName) + .map(new Func1() { + @Override + public Attestation call(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtResourceAsync(String resourceId, String attestationName) { + AttestationsInner client = this.inner(); + return client.deleteAtResourceAsync(resourceId, attestationName).toCompletable(); + } + + @Override + public Observable listAsync(final String subscriptionId) { + AttestationsInner client = this.inner(); + return client.listAsync(subscriptionId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Attestation call(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String subscriptionId, final String resourceGroupName) { + AttestationsInner client = this.inner(); + return client.listByResourceGroupAsync(subscriptionId, resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Attestation call(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForResourceAsync(final String resourceId) { + AttestationsInner client = this.inner(); + return client.listForResourceAsync(resourceId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Attestation call(AttestationInner inner) { + return new AttestationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationsInner.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationsInner.java new file mode 100644 index 000000000000..597bc9627dc4 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/AttestationsInner.java @@ -0,0 +1,2178 @@ +/** + * 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.v2019_10_01.implementation; + +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.v2019_10_01.ErrorResponseException; +import com.microsoft.azure.management.policyinsights.v2019_10_01.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 retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Attestations. + */ +public class AttestationsInner { + /** The Retrofit service to perform REST calls. */ + private AttestationsService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of AttestationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AttestationsInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(AttestationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Attestations to be + * used by Retrofit to perform actually REST calls. + */ + interface AttestationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.Attestations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$filter") String filter, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.Attestations createOrUpdateAtSubscription" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> createOrUpdateAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("attestationName") String attestationName, @Query("api-version") String apiVersion, @Body AttestationInner parameters, @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.v2019_10_01.Attestations beginCreateOrUpdateAtSubscription" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> beginCreateOrUpdateAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("attestationName") String attestationName, @Query("api-version") String apiVersion, @Body AttestationInner parameters, @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.v2019_10_01.Attestations getAtSubscription" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> getAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("attestationName") String attestationName, @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.v2019_10_01.Attestations deleteAtSubscription" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}", method = "DELETE", hasBody = true) + Observable> deleteAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("attestationName") String attestationName, @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.v2019_10_01.Attestations listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$filter") String filter, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.Attestations createOrUpdateAtResourceGroup" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> createOrUpdateAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("attestationName") String attestationName, @Query("api-version") String apiVersion, @Body AttestationInner parameters, @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.v2019_10_01.Attestations beginCreateOrUpdateAtResourceGroup" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> beginCreateOrUpdateAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("attestationName") String attestationName, @Query("api-version") String apiVersion, @Body AttestationInner parameters, @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.v2019_10_01.Attestations getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("attestationName") String attestationName, @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.v2019_10_01.Attestations deleteAtResourceGroup" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}", method = "DELETE", hasBody = true) + Observable> deleteAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("attestationName") String attestationName, @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.v2019_10_01.Attestations listForResource" }) + @GET("{resourceId}/providers/Microsoft.PolicyInsights/attestations") + Observable> listForResource(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$filter") String filter, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.Attestations createOrUpdateAtResource" }) + @PUT("{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> createOrUpdateAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("attestationName") String attestationName, @Query("api-version") String apiVersion, @Body AttestationInner parameters, @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.v2019_10_01.Attestations beginCreateOrUpdateAtResource" }) + @PUT("{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> beginCreateOrUpdateAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("attestationName") String attestationName, @Query("api-version") String apiVersion, @Body AttestationInner parameters, @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.v2019_10_01.Attestations getAtResource" }) + @GET("{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + Observable> getAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("attestationName") String attestationName, @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.v2019_10_01.Attestations deleteAtResource" }) + @HTTP(path = "{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}", method = "DELETE", hasBody = true) + Observable> deleteAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("attestationName") String attestationName, @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.v2019_10_01.Attestations listNext" }) + @GET + Observable> listNext(@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.v2019_10_01.Attestations listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@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.v2019_10_01.Attestations listForResourceNext" }) + @GET + Observable> listForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList list(final String subscriptionId) { + ServiceResponse> response = listSinglePageAsync(subscriptionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String subscriptionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(subscriptionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable> listAsync(final String subscriptionId) { + return listWithServiceResponseAsync(subscriptionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String subscriptionId) { + return listSinglePageAsync(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(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + final String apiVersion = "2019-10-01"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.list(subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList list(final String subscriptionId, final QueryOptions queryOptions) { + ServiceResponse> response = listSinglePageAsync(subscriptionId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @param queryOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String subscriptionId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(subscriptionId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable> listAsync(final String subscriptionId, final QueryOptions queryOptions) { + return listWithServiceResponseAsync(subscriptionId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for the subscription. + * + * @param subscriptionId The ID of the target subscription. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String subscriptionId, final QueryOptions queryOptions) { + return listSinglePageAsync(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(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for the subscription. + * + ServiceResponse> * @param subscriptionId The ID of the target subscription. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String subscriptionId, final QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2019-10-01"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.list(subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner createOrUpdateAtSubscription(String subscriptionId, String attestationName, AttestationInner parameters) { + return createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @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 createOrUpdateAtSubscriptionAsync(String subscriptionId, String attestationName, AttestationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName, parameters), serviceCallback); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAtSubscriptionAsync(String subscriptionId, String attestationName, AttestationInner parameters) { + return createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName, parameters).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateAtSubscriptionWithServiceResponseAsync(String subscriptionId, String attestationName, AttestationInner parameters) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName 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 = "2019-10-01"; + Observable> observable = service.createOrUpdateAtSubscription(subscriptionId, attestationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner beginCreateOrUpdateAtSubscription(String subscriptionId, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @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 beginCreateOrUpdateAtSubscriptionAsync(String subscriptionId, String attestationName, AttestationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName, parameters), serviceCallback); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable beginCreateOrUpdateAtSubscriptionAsync(String subscriptionId, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName, parameters).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable> beginCreateOrUpdateAtSubscriptionWithServiceResponseAsync(String subscriptionId, String attestationName, AttestationInner parameters) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName 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 = "2019-10-01"; + return service.beginCreateOrUpdateAtSubscription(subscriptionId, attestationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateAtSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateAtSubscriptionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner getAtSubscription(String subscriptionId, String attestationName) { + return getAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName).toBlocking().single().body(); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @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 getAtSubscriptionAsync(String subscriptionId, String attestationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName), serviceCallback); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable getAtSubscriptionAsync(String subscriptionId, String attestationName) { + return getAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable> getAtSubscriptionWithServiceResponseAsync(String subscriptionId, String attestationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName is required and cannot be null."); + } + final String apiVersion = "2019-10-01"; + return service.getAtSubscription(subscriptionId, attestationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtSubscriptionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtSubscription(String subscriptionId, String attestationName) { + deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName).toBlocking().single().body(); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @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 deleteAtSubscriptionAsync(String subscriptionId, String attestationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName), serviceCallback); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtSubscriptionAsync(String subscriptionId, String attestationName) { + return deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, attestationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param subscriptionId The ID of the target subscription. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtSubscriptionWithServiceResponseAsync(String subscriptionId, String attestationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName is required and cannot be null."); + } + final String apiVersion = "2019-10-01"; + return service.deleteAtSubscription(subscriptionId, attestationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtSubscriptionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList listByResourceGroup(final String subscriptionId, final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(subscriptionId, resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(subscriptionId, resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable> listByResourceGroupAsync(final String subscriptionId, final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(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."); + } + final String apiVersion = "2019-10-01"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listByResourceGroup(subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList listByResourceGroup(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param queryOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable> listByResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for the resource group. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final QueryOptions queryOptions) { + return listByResourceGroupSinglePageAsync(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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for the resource group. + * + ServiceResponse> * @param subscriptionId The ID of the target subscription. + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(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."); + } + Validator.validate(queryOptions); + final String apiVersion = "2019-10-01"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listByResourceGroup(subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner createOrUpdateAtResourceGroup(String subscriptionId, String resourceGroupName, String attestationName, AttestationInner parameters) { + return createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @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 createOrUpdateAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName, AttestationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName, parameters), serviceCallback); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName, AttestationInner parameters) { + return createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName, parameters).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String attestationName, AttestationInner parameters) { + 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 (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName 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 = "2019-10-01"; + Observable> observable = service.createOrUpdateAtResourceGroup(subscriptionId, resourceGroupName, attestationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner beginCreateOrUpdateAtResourceGroup(String subscriptionId, String resourceGroupName, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @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 beginCreateOrUpdateAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName, AttestationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName, parameters), serviceCallback); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable beginCreateOrUpdateAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName, parameters).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable> beginCreateOrUpdateAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String attestationName, AttestationInner parameters) { + 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 (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName 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 = "2019-10-01"; + return service.beginCreateOrUpdateAtResourceGroup(subscriptionId, resourceGroupName, attestationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateAtResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateAtResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner getByResourceGroup(String subscriptionId, String resourceGroupName, String attestationName) { + return getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName).toBlocking().single().body(); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @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 getByResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName), serviceCallback); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable getByResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName) { + return getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String attestationName) { + 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 (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName is required and cannot be null."); + } + final String apiVersion = "2019-10-01"; + return service.getByResourceGroup(subscriptionId, resourceGroupName, attestationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtResourceGroup(String subscriptionId, String resourceGroupName, String attestationName) { + deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName).toBlocking().single().body(); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @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 deleteAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName), serviceCallback); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String attestationName) { + return deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, attestationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param subscriptionId The ID of the target subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String attestationName) { + 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 (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName is required and cannot be null."); + } + final String apiVersion = "2019-10-01"; + return service.deleteAtResourceGroup(subscriptionId, resourceGroupName, attestationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList listForResource(final String resourceId) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @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> listForResourceAsync(final String resourceId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable> listForResourceAsync(final String resourceId) { + return listForResourceWithServiceResponseAsync(resourceId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceId) { + return listForResourceSinglePageAsync(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(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceId) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + final String apiVersion = "2019-10-01"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listForResource(resourceId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList listForResource(final String resourceId, final QueryOptions queryOptions) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param queryOptions Additional parameters for the operation + * @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> listForResourceAsync(final String resourceId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable> listForResourceAsync(final String resourceId, final QueryOptions queryOptions) { + return listForResourceWithServiceResponseAsync(resourceId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AttestationInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceId, final QueryOptions queryOptions) { + return listForResourceSinglePageAsync(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(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for a 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<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceId, final QueryOptions queryOptions) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2019-10-01"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listForResource(resourceId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner createOrUpdateAtResource(String resourceId, String attestationName, AttestationInner parameters) { + return createOrUpdateAtResourceWithServiceResponseAsync(resourceId, attestationName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @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 createOrUpdateAtResourceAsync(String resourceId, String attestationName, AttestationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtResourceWithServiceResponseAsync(resourceId, attestationName, parameters), serviceCallback); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAtResourceAsync(String resourceId, String attestationName, AttestationInner parameters) { + return createOrUpdateAtResourceWithServiceResponseAsync(resourceId, attestationName, parameters).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateAtResourceWithServiceResponseAsync(String resourceId, String attestationName, AttestationInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName 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 = "2019-10-01"; + Observable> observable = service.createOrUpdateAtResource(resourceId, attestationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner beginCreateOrUpdateAtResource(String resourceId, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtResourceWithServiceResponseAsync(resourceId, attestationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @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 beginCreateOrUpdateAtResourceAsync(String resourceId, String attestationName, AttestationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateAtResourceWithServiceResponseAsync(resourceId, attestationName, parameters), serviceCallback); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable beginCreateOrUpdateAtResourceAsync(String resourceId, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtResourceWithServiceResponseAsync(resourceId, attestationName, parameters).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable> beginCreateOrUpdateAtResourceWithServiceResponseAsync(String resourceId, String attestationName, AttestationInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName 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 = "2019-10-01"; + return service.beginCreateOrUpdateAtResource(resourceId, attestationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateAtResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateAtResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AttestationInner object if successful. + */ + public AttestationInner getAtResource(String resourceId, String attestationName) { + return getAtResourceWithServiceResponseAsync(resourceId, attestationName).toBlocking().single().body(); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @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 getAtResourceAsync(String resourceId, String attestationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtResourceWithServiceResponseAsync(resourceId, attestationName), serviceCallback); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable getAtResourceAsync(String resourceId, String attestationName) { + return getAtResourceWithServiceResponseAsync(resourceId, attestationName).map(new Func1, AttestationInner>() { + @Override + public AttestationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AttestationInner object + */ + public Observable> getAtResourceWithServiceResponseAsync(String resourceId, String attestationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName is required and cannot be null."); + } + final String apiVersion = "2019-10-01"; + return service.getAtResource(resourceId, attestationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtResource(String resourceId, String attestationName) { + deleteAtResourceWithServiceResponseAsync(resourceId, attestationName).toBlocking().single().body(); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @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 deleteAtResourceAsync(String resourceId, String attestationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtResourceWithServiceResponseAsync(resourceId, attestationName), serviceCallback); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtResourceAsync(String resourceId, String attestationName) { + return deleteAtResourceWithServiceResponseAsync(resourceId, attestationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtResourceWithServiceResponseAsync(String resourceId, String attestationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (attestationName == null) { + throw new IllegalArgumentException("Parameter attestationName is required and cannot be null."); + } + final String apiVersion = "2019-10-01"; + return service.deleteAtResource(resourceId, attestationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all attestations for the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for 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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for 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<AttestationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for 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<AttestationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for 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<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all attestations for the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for 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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for 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<AttestationInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for 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<AttestationInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for 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<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all attestations for a resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AttestationInner> object if successful. + */ + public PagedList listForResourceNext(final String nextPageLink) { + ServiceResponse> response = listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all attestations for a 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> listForResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all attestations for a 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<AttestationInner> object + */ + public Observable> listForResourceNextAsync(final String nextPageLink) { + return listForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all attestations for a 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<AttestationInner> object + */ + public Observable>> listForResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listForResourceNextSinglePageAsync(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(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all attestations for a 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<AttestationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceNextSinglePageAsync(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.listForResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PageImpl1.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PageImpl1.java new file mode 100644 index 000000000000..deeaea3a0776 --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/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.v2019_10_01.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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventImpl.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventImpl.java new file mode 100644 index 000000000000..4a6770fe0b1b --- /dev/null +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventImpl.java @@ -0,0 +1,190 @@ +/** + * 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.v2019_10_01.implementation; + +import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyEvent; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.policyinsights.v2019_10_01.ComponentEventDetails; +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 complianceState() { + return this.inner().complianceState(); + } + + @Override + public List components() { + return this.inner().components(); + } + + @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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventInner.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventInner.java index 52e79bbcadc6..f49e178d597a 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventInner.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventInner.java @@ -10,6 +10,8 @@ import java.util.Map; import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.policyinsights.v2019_10_01.ComponentEventDetails; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -193,6 +195,12 @@ public class PolicyEventInner { @JsonProperty(value = "policyDefinitionReferenceId") private String policyDefinitionReferenceId; + /** + * Compliance state of the resource. + */ + @JsonProperty(value = "complianceState") + private String complianceState; + /** * Tenant ID for the policy event record. */ @@ -206,6 +214,13 @@ public class PolicyEventInner { @JsonProperty(value = "principalOid") private String principalOid; + /** + * Components events records populated only when URL contains + * $expand=components clause. + */ + @JsonProperty(value = "components") + private List components; + /** * Get unmatched properties from the message are deserialized this collection. * @@ -766,6 +781,26 @@ public PolicyEventInner withPolicyDefinitionReferenceId(String policyDefinitionR return this; } + /** + * Get compliance state of the resource. + * + * @return the complianceState value + */ + public String complianceState() { + return this.complianceState; + } + + /** + * Set compliance state of the resource. + * + * @param complianceState the complianceState value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withComplianceState(String complianceState) { + this.complianceState = complianceState; + return this; + } + /** * Get tenant ID for the policy event record. * @@ -806,4 +841,24 @@ public PolicyEventInner withPrincipalOid(String principalOid) { return this; } + /** + * Get components events records populated only when URL contains $expand=components clause. + * + * @return the components value + */ + public List components() { + return this.components; + } + + /** + * Set components events records populated only when URL contains $expand=components clause. + * + * @param components the components value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withComponents(List components) { + this.components = components; + return this; + } + } diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventsImpl.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventsImpl.java index 9ec4f34bd53c..f535baecfffd 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventsImpl.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventsImpl.java @@ -13,7 +13,8 @@ import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyEvents; import rx.functions.Func1; import rx.Observable; -import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyEventsQueryResults; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policyinsights.v2019_10_01.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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventsInner.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventsInner.java index d8ff1f941b71..cd9f1fc72f7e 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyEventsInner.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/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.v2019_10_01.QueryFailureException; import com.microsoft.azure.management.policyinsights.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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("$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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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,36 @@ 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."); } final String policyEventsResource = "default"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -156,13 +225,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, 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 +248,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 +269,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 +287,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 +305,38 @@ 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."); } Validator.validate(queryOptions); final String policyEventsResource = "default"; final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -258,13 +365,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, 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 +383,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 +397,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 +417,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 +434,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 +472,14 @@ 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."); } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -341,13 +488,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, 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 +511,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 +532,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 +550,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 +568,37 @@ public PolicyEventsQueryResultsInner call(ServiceResponse> listQueryResultsForSubscriptionWithServiceResponseAsync(String subscriptionId, QueryOptions queryOptions) { + public Observable>> 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>> listQueryResultsForSubscriptionSinglePageAsync(final String subscriptionId, final QueryOptions queryOptions) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -442,13 +627,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, 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 +645,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 +660,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 +681,34 @@ 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); + } + + /** + * 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> listQueryResultsForResourceGroupAsync(final String subscriptionId, final String resourceGroupName) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -496,15 +717,20 @@ 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>> 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,9 +739,9 @@ 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."); } @@ -523,7 +749,7 @@ public Observable> listQueryResul throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -532,13 +758,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, 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 +782,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 +804,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 +823,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,9 +842,32 @@ 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."); } @@ -611,7 +876,7 @@ public Observable> listQueryResul } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -640,13 +905,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, 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 +923,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 +937,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 +957,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 +974,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 +1012,14 @@ 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."); } final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -723,13 +1028,15 @@ 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 expand = null; + String skipToken = null; + return service.listQueryResultsForResource(policyEventsResource, resourceId, 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); } @@ -745,10 +1052,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 +1073,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 +1091,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 +1109,37 @@ 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."); } Validator.validate(queryOptions); final String policyEventsResource = "default"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -824,13 +1168,21 @@ 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 expand = null; + if (queryOptions != null) { + expand = queryOptions.expand(); + } + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForResource(policyEventsResource, resourceId, 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); } @@ -838,9 +1190,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 +1205,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 +1226,16 @@ public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(Stri * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); + public ServiceFuture> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -878,15 +1244,38 @@ public ServiceFuture listQueryResultsForPolicySet * @param subscriptionId Microsoft Azure subscription ID. * @param policySetDefinitionName Policy set definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyEventsQueryResultsInner object + * @return the observable to the PagedList<PolicyEventInner> object */ - public Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).map(new Func1, PolicyEventsQueryResultsInner>() { - @Override - public PolicyEventsQueryResultsInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listQueryResultsForPolicySetDefinitionAsync(final String subscriptionId, final String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyEventInner> object + */ + public Observable>> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(final String subscriptionId, final String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionSinglePageAsync(subscriptionId, policySetDefinitionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForPolicySetDefinitionNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -895,9 +1284,9 @@ 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."); } @@ -906,7 +1295,7 @@ public Observable> listQueryResul } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -915,13 +1304,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, 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 +1328,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 +1350,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 +1369,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,9 +1388,32 @@ 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."); } @@ -995,7 +1423,7 @@ public Observable> listQueryResul Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1024,13 +1452,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, 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 +1470,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 +1485,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 +1506,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 +1524,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,9 +1564,9 @@ 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."); } @@ -1106,7 +1575,7 @@ public Observable> listQueryResul } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1115,13 +1584,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, 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 +1608,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 +1630,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,17 +1649,18 @@ 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(); + } + }); + } + /** * Queries policy events for the subscription level policy definition. * @@ -1183,9 +1668,32 @@ 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."); } @@ -1195,7 +1703,7 @@ public Observable> listQueryResul Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1224,13 +1732,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, 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 +1750,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 +1765,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 +1786,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 +1804,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,9 +1844,9 @@ 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."); } @@ -1306,7 +1855,7 @@ public Observable> listQueryResul } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1315,13 +1864,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, 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 +1888,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 +1910,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 +1929,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,9 +1948,32 @@ 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."); } @@ -1395,7 +1983,7 @@ public Observable> listQueryResul Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1424,13 +2012,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, 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 +2030,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 +2046,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 +2068,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 +2087,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 +2129,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."); } @@ -1513,7 +2143,7 @@ public Observable> listQueryResul } final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; final QueryOptions queryOptions = null; Integer top = null; String orderBy = null; @@ -1522,13 +2152,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, 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 +2177,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 +2200,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 +2220,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 +2240,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."); } @@ -1609,7 +2279,7 @@ public Observable> listQueryResul Validator.validate(queryOptions); final String policyEventsResource = "default"; final String authorizationNamespace = "Microsoft.Authorization"; - final String apiVersion = "2018-04-04"; + final String apiVersion = "2019-10-01"; Integer top = null; if (queryOptions != null) { top = queryOptions.top(); @@ -1638,13 +2308,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, 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 +2437,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(); + } + }); + } + + /** + * 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)); + } + }); } /** - * Gets OData metadata XML document. + * 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 +3214,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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyInsightsClientImpl.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyInsightsClientImpl.java index 074ac33762e2..c83453eb886c 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyInsightsClientImpl.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyInsightsClientImpl.java @@ -10,6 +10,8 @@ import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; @@ -28,6 +30,29 @@ public AzureClient getAzureClient() { return this.azureClient; } + /** The ID of the target subscription. */ + private String subscriptionId2; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId2 value. + */ + public String subscriptionId2() { + return this.subscriptionId2; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId2 the subscriptionId2 value. + * @return the service client itself + */ + public PolicyInsightsClientImpl withSubscriptionId2(String subscriptionId2) { + this.subscriptionId2 = subscriptionId2; + return this; + } + /** The preferred language for the response. */ private String acceptLanguage; @@ -175,6 +200,19 @@ public PolicyMetadatasInner policyMetadatas() { return this.policyMetadatas; } + /** + * The AttestationsInner object to access its operations. + */ + private AttestationsInner attestations; + + /** + * Gets the AttestationsInner object to access its operations. + * @return the AttestationsInner object. + */ + public AttestationsInner attestations() { + return this.attestations; + } + /** * Initializes an instance of PolicyInsightsClient client. * @@ -215,6 +253,7 @@ protected void initialize() { this.policyStates = new PolicyStatesInner(restClient().retrofit(), this); this.operations = new OperationsInner(restClient().retrofit(), this); this.policyMetadatas = new PolicyMetadatasInner(restClient().retrofit(), this); + this.attestations = new AttestationsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyInsightsManager.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyInsightsManager.java index 6c8774de9f97..de41f7f56450 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyInsightsManager.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyInsightsManager.java @@ -22,6 +22,7 @@ import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyStates; import com.microsoft.azure.management.policyinsights.v2019_10_01.Operations; import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyMetadatas; +import com.microsoft.azure.management.policyinsights.v2019_10_01.Attestations; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -35,6 +36,7 @@ public final class PolicyInsightsManager extends ManagerCore 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 List components() { + return this.inner().components(); + } + + @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 policyAssignmentVersion() { + return this.inner().policyAssignmentVersion(); + } + + @Override + public String policyDefinitionAction() { + return this.inner().policyDefinitionAction(); + } + + @Override + public String policyDefinitionCategory() { + return this.inner().policyDefinitionCategory(); + } + + @Override + public List policyDefinitionGroupNames() { + return this.inner().policyDefinitionGroupNames(); + } + + @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 policyDefinitionVersion() { + return this.inner().policyDefinitionVersion(); + } + + @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 policySetDefinitionVersion() { + return this.inner().policySetDefinitionVersion(); + } + + @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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStateInner.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStateInner.java index ccb6f3383dcd..2fd3c4d807cb 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStateInner.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStateInner.java @@ -12,6 +12,7 @@ import org.joda.time.DateTime; import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyEvaluationDetails; import java.util.List; +import com.microsoft.azure.management.policyinsights.v2019_10_01.ComponentStateDetails; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -214,6 +215,31 @@ public class PolicyStateInner { @JsonProperty(value = "policyDefinitionGroupNames") private List policyDefinitionGroupNames; + /** + * Components state compliance records populated only when URL contains + * $expand=components clause. + */ + @JsonProperty(value = "components") + private List components; + + /** + * Evaluated policy definition version. + */ + @JsonProperty(value = "policyDefinitionVersion", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionVersion; + + /** + * Evaluated policy set definition version. + */ + @JsonProperty(value = "policySetDefinitionVersion", access = JsonProperty.Access.WRITE_ONLY) + private String policySetDefinitionVersion; + + /** + * Evaluated policy assignment version. + */ + @JsonProperty(value = "policyAssignmentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentVersion; + /** * Get unmatched properties from the message are deserialized this collection. * @@ -834,4 +860,51 @@ public PolicyStateInner withPolicyDefinitionGroupNames(List policyDefini return this; } + /** + * Get components state compliance records populated only when URL contains $expand=components clause. + * + * @return the components value + */ + public List components() { + return this.components; + } + + /** + * Set components state compliance records populated only when URL contains $expand=components clause. + * + * @param components the components value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withComponents(List components) { + this.components = components; + return this; + } + + /** + * Get evaluated policy definition version. + * + * @return the policyDefinitionVersion value + */ + public String policyDefinitionVersion() { + return this.policyDefinitionVersion; + } + + /** + * Get evaluated policy set definition version. + * + * @return the policySetDefinitionVersion value + */ + public String policySetDefinitionVersion() { + return this.policySetDefinitionVersion; + } + + /** + * Get evaluated policy assignment version. + * + * @return the policyAssignmentVersion value + */ + public String policyAssignmentVersion() { + return this.policyAssignmentVersion; + } + } diff --git a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStatesImpl.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStatesImpl.java index bf7a59f3ddb8..b6939a98271a 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStatesImpl.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStatesImpl.java @@ -11,9 +11,11 @@ import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyStates; +import rx.Completable; import rx.functions.Func1; import rx.Observable; -import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyStatesQueryResults; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyState; import com.microsoft.azure.management.policyinsights.v2019_10_01.SummarizeResults; import com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyStatesResource; @@ -30,13 +32,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 +62,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 +92,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 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()); } }); } @@ -102,13 +122,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId) { + public Observable listQueryResultsForResourceAsync(final PolicyStatesResource policyStatesResource, final String resourceId) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForResourceAsync(policyStatesResource, resourceId) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -126,13 +152,31 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + public Completable triggerSubscriptionEvaluationAsync(String subscriptionId) { + PolicyStatesInner client = this.inner(); + return client.triggerSubscriptionEvaluationAsync(subscriptionId).toCompletable(); + } + + @Override + public Completable triggerResourceGroupEvaluationAsync(String subscriptionId, String resourceGroupName) { + PolicyStatesInner client = this.inner(); + return client.triggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName).toCompletable(); + } + + @Override + 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 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()); } }); } @@ -150,13 +194,19 @@ public SummarizeResults call(SummarizeResultsInner inner) { } @Override - public Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + public Observable listQueryResultsForPolicyDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyDefinitionName) { PolicyStatesInner client = this.inner(); return client.listQueryResultsForPolicyDefinitionAsync(policyStatesResource, subscriptionId, policyDefinitionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { - return new PolicyStatesQueryResultsImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyState call(PolicyStateInner inner) { + return new PolicyStateImpl(inner, manager()); } }); } @@ -174,13 +224,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 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()); } }); } @@ -198,13 +254,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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStatesInner.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStatesInner.java index bc4c4cca0791..5450c301dfa5 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStatesInner.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStatesInner.java @@ -10,24 +10,33 @@ 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.v2019_10_01.PolicyStatesResource; import com.microsoft.azure.management.policyinsights.v2019_10_01.QueryFailureException; import com.microsoft.azure.management.policyinsights.v2019_10_01.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; import retrofit2.http.Header; import retrofit2.http.Headers; 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; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -57,7 +66,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.v2019_10_01.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.v2019_10_01.PolicyStates summarizeForManagementGroup" }) @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -65,7 +74,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.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.v2019_10_01.PolicyStates summarizeForSubscription" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -73,7 +82,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.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.v2019_10_01.PolicyStates summarizeForResourceGroup" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -81,15 +90,31 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.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.v2019_10_01.PolicyStates summarizeForResource" }) @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") Observable> summarizeForResource(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyStates triggerSubscriptionEvaluation" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation") + Observable> triggerSubscriptionEvaluation(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyStates beginTriggerSubscriptionEvaluation" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation") + Observable> beginTriggerSubscriptionEvaluation(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.PolicyStates triggerResourceGroupEvaluation" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation") + Observable> triggerResourceGroupEvaluation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @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.v2019_10_01.PolicyStates beginTriggerResourceGroupEvaluation" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation") + Observable> beginTriggerResourceGroupEvaluation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @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.v2019_10_01.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.v2019_10_01.PolicyStates summarizeForPolicySetDefinition" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -97,7 +122,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.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.v2019_10_01.PolicyStates summarizeForPolicyDefinition" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -105,7 +130,7 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.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.v2019_10_01.PolicyStates summarizeForSubscriptionLevelPolicyAssignment" }) @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") @@ -113,12 +138,44 @@ interface PolicyStatesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.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.v2019_10_01.PolicyStates summarizeForResourceGroupLevelPolicyAssignment" }) @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") Observable> summarizeForResourceGroupLevelPolicyAssignment(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @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("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.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.v2019_10_01.PolicyStates listQueryResultsForResourceGroupLevelPolicyAssignmentNext" }) + @GET + Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -129,10 +186,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(); + } + }; } /** @@ -144,8 +207,34 @@ 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); + } + + /** + * 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> listQueryResultsForManagementGroupAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -154,15 +243,20 @@ 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>> 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)); + } + }); } /** @@ -171,9 +265,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."); } @@ -190,13 +284,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, 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); } @@ -213,10 +308,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(); + } + }; } /** @@ -229,8 +330,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); } /** @@ -240,15 +349,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(); + } + }); } /** @@ -258,9 +368,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) { + public Observable>> 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>> listQueryResultsForManagementGroupSinglePageAsync(final PolicyStatesResource policyStatesResource, final String managementGroupName, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -298,13 +431,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, 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); } @@ -312,9 +449,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); } @@ -498,10 +635,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(); + } + }; } /** @@ -513,8 +656,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); } /** @@ -523,15 +674,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)); + } + }); } /** @@ -540,9 +714,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."); } @@ -558,13 +732,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, 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); } @@ -581,10 +756,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(); + } + }; } /** @@ -597,8 +778,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); } /** @@ -608,15 +797,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(); + } + }); } /** @@ -626,9 +816,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForSubscriptionWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForSubscriptionSinglePageAsync(policyStatesResource, subscriptionId, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resources under the subscription. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -665,13 +878,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, 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); } @@ -679,9 +896,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); } @@ -864,10 +1081,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(); + } + }; } /** @@ -880,8 +1103,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); } /** @@ -891,15 +1122,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)); + } + }); } /** @@ -909,9 +1164,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."); } @@ -930,13 +1185,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, 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); } @@ -954,10 +1210,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(); + } + }; } /** @@ -971,8 +1233,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); } /** @@ -983,15 +1253,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(); + } + }); } /** @@ -1002,9 +1273,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."); } @@ -1044,13 +1339,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, 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); } @@ -1058,9 +1357,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); } @@ -1256,10 +1555,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(); + } + }; } /** @@ -1271,8 +1576,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); } /** @@ -1281,15 +1594,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)); + } + }); } /** @@ -1298,9 +1634,9 @@ public PolicyStatesQueryResultsInner call(ServiceResponse> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId) { + public Observable>> listQueryResultsForResourceSinglePageAsync(final PolicyStatesResource policyStatesResource, final String resourceId) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -1317,13 +1653,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, 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); } @@ -1340,10 +1677,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(); + } + }; } /** @@ -1356,8 +1699,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); } /** @@ -1367,15 +1718,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(); + } + }); } /** @@ -1385,9 +1737,32 @@ public PolicyStatesQueryResultsInner call(ServiceResponse>> listQueryResultsForResourceWithServiceResponseAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceSinglePageAsync(policyStatesResource, resourceId, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resource. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param resourceId Resource ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { + public Observable>> listQueryResultsForResourceSinglePageAsync(final PolicyStatesResource policyStatesResource, final String resourceId, final QueryOptions queryOptions) { if (policyStatesResource == null) { throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); } @@ -1428,13 +1803,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, 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); } @@ -1442,9 +1821,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); } @@ -1619,202 +1998,119 @@ private ServiceResponse summarizeForResourceDelegate(Resp } /** - * Queries policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all 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. - * @param policySetDefinitionName Policy set definition name. * @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. */ - public PolicyStatesQueryResultsInner listQueryResultsForPolicySetDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName).toBlocking().single().body(); + public void triggerSubscriptionEvaluation(String subscriptionId) { + triggerSubscriptionEvaluationWithServiceResponseAsync(subscriptionId).toBlocking().last().body(); } /** - * Queries policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all 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. - * @param policySetDefinitionName Policy set definition name. * @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 listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName), serviceCallback); + public ServiceFuture triggerSubscriptionEvaluationAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(triggerSubscriptionEvaluationWithServiceResponseAsync(subscriptionId), serviceCallback); } /** - * Queries policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all 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. - * @param policySetDefinitionName Policy set definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable for the request */ - public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName).map(new Func1, PolicyStatesQueryResultsInner>() { + public Observable triggerSubscriptionEvaluationAsync(String subscriptionId) { + return triggerSubscriptionEvaluationWithServiceResponseAsync(subscriptionId).map(new Func1, Void>() { @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Queries policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all 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. - * @param policySetDefinitionName Policy set definition name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PolicyStatesQueryResultsInner object + * @return the observable for the request */ - public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { - if (policyStatesResource == null) { - throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); - } + public Observable> triggerSubscriptionEvaluationWithServiceResponseAsync(String subscriptionId) { 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."); - } - final String authorizationNamespace = "Microsoft.Authorization"; final String apiVersion = "2019-10-01"; - final QueryOptions queryOptions = null; - Integer top = null; - String orderBy = null; - String select = null; - DateTime from = null; - 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>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); + Observable> observable = service.triggerSubscriptionEvaluation(subscriptionId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); } /** - * Queries policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all 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. - * @param policySetDefinitionName Policy set definition name. - * @param queryOptions Additional parameters for the 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 PolicyStatesQueryResultsInner object if successful. */ - public PolicyStatesQueryResultsInner listQueryResultsForPolicySetDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + public void beginTriggerSubscriptionEvaluation(String subscriptionId) { + beginTriggerSubscriptionEvaluationWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); } /** - * Queries policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all 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. - * @param policySetDefinitionName Policy set definition name. - * @param queryOptions Additional parameters for the operation * @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 listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions), serviceCallback); + public ServiceFuture beginTriggerSubscriptionEvaluationAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginTriggerSubscriptionEvaluationWithServiceResponseAsync(subscriptionId), serviceCallback); } /** - * Queries policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all 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. - * @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 {@link ServiceResponse} object if successful. */ - public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { + public Observable beginTriggerSubscriptionEvaluationAsync(String subscriptionId) { + return beginTriggerSubscriptionEvaluationWithServiceResponseAsync(subscriptionId).map(new Func1, Void>() { @Override - public PolicyStatesQueryResultsInner call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Queries policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all 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. - * @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 {@link ServiceResponse} object if successful. */ - public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - if (policyStatesResource == null) { - throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); - } + public Observable> beginTriggerSubscriptionEvaluationWithServiceResponseAsync(String subscriptionId) { 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."); - } - Validator.validate(queryOptions); - final String authorizationNamespace = "Microsoft.Authorization"; final String apiVersion = "2019-10-01"; - Integer top = null; - if (queryOptions != null) { - top = queryOptions.top(); - } - String orderBy = null; - if (queryOptions != null) { - orderBy = queryOptions.orderBy(); - } - String select = null; - if (queryOptions != null) { - select = queryOptions.select(); - } - DateTime from = null; - if (queryOptions != null) { - from = queryOptions.from(); - } - DateTime to = null; - if (queryOptions != null) { - to = queryOptions.to(); - } - String filter = null; - if (queryOptions != null) { - filter = queryOptions.filter(); - } - String apply = null; - if (queryOptions != null) { - apply = queryOptions.apply(); - } - return service.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, orderBy, select, from, to, filter, apply, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginTriggerSubscriptionEvaluation(subscriptionId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); + ServiceResponse clientResponse = beginTriggerSubscriptionEvaluationDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1823,183 +2119,142 @@ 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 beginTriggerSubscriptionEvaluationDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) .registerError(QueryFailureException.class) .build(response); } /** - * Summarizes policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all the resources under the resource group. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policySetDefinitionName Policy set definition name. + * @param resourceGroupName Resource group name. * @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 SummarizeResultsInner object if successful. */ - public SummarizeResultsInner summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { - return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).toBlocking().single().body(); + public void triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName) { + triggerResourceGroupEvaluationWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().last().body(); } /** - * Summarizes policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all the resources under the resource group. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policySetDefinitionName Policy set definition name. + * @param resourceGroupName Resource group name. * @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 summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); + public ServiceFuture triggerResourceGroupEvaluationAsync(String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(triggerResourceGroupEvaluationWithServiceResponseAsync(subscriptionId, resourceGroupName), serviceCallback); } /** - * Summarizes policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all the resources under the resource group. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policySetDefinitionName Policy set definition name. + * @param resourceGroupName Resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SummarizeResultsInner object + * @return the observable for the request */ - public Observable summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { - return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).map(new Func1, SummarizeResultsInner>() { + public Observable triggerResourceGroupEvaluationAsync(String subscriptionId, String resourceGroupName) { + return triggerResourceGroupEvaluationWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1, Void>() { @Override - public SummarizeResultsInner call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Summarizes policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all the resources under the resource group. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policySetDefinitionName Policy set definition name. + * @param resourceGroupName Resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SummarizeResultsInner object + * @return the observable for the request */ - public Observable> summarizeForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName) { + public Observable> triggerResourceGroupEvaluationWithServiceResponseAsync(String subscriptionId, String resourceGroupName) { 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 (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - final String policyStatesSummaryResource = "latest"; - final String authorizationNamespace = "Microsoft.Authorization"; final String apiVersion = "2019-10-01"; - 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()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = summarizeForPolicySetDefinitionDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); + Observable> observable = service.triggerResourceGroupEvaluation(subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); } /** - * Summarizes policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all the resources under the resource group. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policySetDefinitionName Policy set definition name. - * @param queryOptions Additional parameters for the operation + * @param resourceGroupName Resource group name. * @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 SummarizeResultsInner object if successful. */ - public SummarizeResultsInner summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + public void beginTriggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName) { + beginTriggerResourceGroupEvaluationWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); } /** - * Summarizes policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all the resources under the resource group. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policySetDefinitionName Policy set definition name. - * @param queryOptions Additional parameters for the operation + * @param resourceGroupName Resource group name. * @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 summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions), serviceCallback); + public ServiceFuture beginTriggerResourceGroupEvaluationAsync(String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginTriggerResourceGroupEvaluationWithServiceResponseAsync(subscriptionId, resourceGroupName), serviceCallback); } /** - * Summarizes policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all the resources under the resource group. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policySetDefinitionName Policy set definition name. - * @param queryOptions Additional parameters for the operation + * @param resourceGroupName Resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SummarizeResultsInner object + * @return the {@link ServiceResponse} object if successful. */ - public Observable summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { - return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).map(new Func1, SummarizeResultsInner>() { + public Observable beginTriggerResourceGroupEvaluationAsync(String subscriptionId, String resourceGroupName) { + return beginTriggerResourceGroupEvaluationWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1, Void>() { @Override - public SummarizeResultsInner call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Summarizes policy states for the subscription level policy set definition. + * Triggers a policy evaluation scan for all the resources under the resource group. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policySetDefinitionName Policy set definition name. - * @param queryOptions Additional parameters for the operation + * @param resourceGroupName Resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SummarizeResultsInner object + * @return the {@link ServiceResponse} object if successful. */ - public Observable> summarizeForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + public Observable> beginTriggerResourceGroupEvaluationWithServiceResponseAsync(String subscriptionId, String resourceGroupName) { 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 (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - Validator.validate(queryOptions); - final String policyStatesSummaryResource = "latest"; - final String authorizationNamespace = "Microsoft.Authorization"; final String apiVersion = "2019-10-01"; - Integer top = null; - if (queryOptions != null) { - top = queryOptions.top(); - } - DateTime from = null; - if (queryOptions != null) { - from = queryOptions.from(); - } - DateTime to = null; - if (queryOptions != null) { - to = queryOptions.to(); - } - String filter = null; - if (queryOptions != null) { - filter = queryOptions.filter(); - } - return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginTriggerResourceGroupEvaluation(subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = summarizeForPolicySetDefinitionDelegate(response); + ServiceResponse clientResponse = beginTriggerResourceGroupEvaluationDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2008,78 +2263,117 @@ public Observable> call(Response summarizeForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse beginTriggerResourceGroupEvaluationDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) .registerError(QueryFailureException.class) .build(response); } /** - * Queries policy states for the subscription level policy definition. + * 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 policyDefinitionName Policy definition name. + * @param policySetDefinitionName Policy set definition name. * @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 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(); + } + }; } /** - * Queries policy states for the subscription level policy definition. + * 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 policyDefinitionName Policy definition name. + * @param policySetDefinitionName Policy set definition name. * @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 listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName), 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); } /** - * Queries policy states for the subscription level policy definition. + * 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 policyDefinitionName Policy definition name. + * @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 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> 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 definition. + * 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 policyDefinitionName Policy definition name. + * @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)); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + 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."); } 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 (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } final String authorizationNamespace = "Microsoft.Authorization"; final String apiVersion = "2019-10-01"; @@ -2091,13 +2385,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.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, 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 = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2106,74 +2401,113 @@ public Observable> call(Response< } /** - * Queries policy states for the subscription level policy definition. + * 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 policyDefinitionName Policy definition name. + * @param policySetDefinitionName Policy set definition name. * @param queryOptions Additional parameters for the 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 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 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(); + } + }; } /** - * Queries policy states for the subscription level policy definition. + * 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 policyDefinitionName Policy definition name. + * @param policySetDefinitionName Policy set definition name. * @param queryOptions Additional parameters for the operation * @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 listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, 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); } /** - * Queries policy states for the subscription level policy definition. + * 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 policyDefinitionName Policy definition name. + * @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 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> listQueryResultsForPolicySetDefinitionAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policySetDefinitionName, final QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Queries policy states for the subscription level policy definition. + * 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 policyDefinitionName Policy definition name. + * @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>> 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> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, 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."); } 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 (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; @@ -2206,13 +2540,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.listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policySetDefinitionName, 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 = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2220,50 +2558,50 @@ 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> 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); } /** - * Summarizes policy states for the subscription level policy definition. + * Summarizes policy states for the subscription level policy set definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyDefinitionName Policy definition name. + * @param policySetDefinitionName Policy set definition name. * @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 SummarizeResultsInner object if successful. */ - public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName) { - return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).toBlocking().single().body(); + public SummarizeResultsInner summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { + return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).toBlocking().single().body(); } /** - * Summarizes policy states for the subscription level policy definition. + * Summarizes policy states for the subscription level policy set definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyDefinitionName Policy definition name. + * @param policySetDefinitionName Policy set definition name. * @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 summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName), serviceCallback); + public ServiceFuture summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); } /** - * Summarizes policy states for the subscription level policy definition. + * Summarizes policy states for the subscription level policy set definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyDefinitionName Policy definition name. + * @param policySetDefinitionName Policy set definition name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the SummarizeResultsInner object */ - public Observable summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { - return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).map(new Func1, SummarizeResultsInner>() { + public Observable summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { + return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).map(new Func1, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse response) { return response.body(); @@ -2272,19 +2610,19 @@ public SummarizeResultsInner call(ServiceResponse respons } /** - * Summarizes policy states for the subscription level policy definition. + * Summarizes policy states for the subscription level policy set definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyDefinitionName Policy definition name. + * @param policySetDefinitionName Policy set definition name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the SummarizeResultsInner object */ - public Observable> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { + public Observable> summarizeForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName) { 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 (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; @@ -2294,12 +2632,12 @@ public Observable> summarizeForPolicyDefi 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.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = summarizeForPolicyDefinitionDelegate(response); + ServiceResponse clientResponse = summarizeForPolicySetDefinitionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2309,45 +2647,45 @@ public Observable> call(Response summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions), serviceCallback); + public ServiceFuture summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions), serviceCallback); } /** - * Summarizes policy states for the subscription level policy definition. + * Summarizes policy states for the subscription level policy set definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyDefinitionName Policy definition name. + * @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 SummarizeResultsInner object */ - public Observable summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { - return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).map(new Func1, SummarizeResultsInner>() { + public Observable summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).map(new Func1, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse response) { return response.body(); @@ -2356,20 +2694,20 @@ public SummarizeResultsInner call(ServiceResponse respons } /** - * Summarizes policy states for the subscription level policy definition. + * Summarizes policy states for the subscription level policy set definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyDefinitionName Policy definition name. + * @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 SummarizeResultsInner object */ - public Observable> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + public Observable> summarizeForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName, 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 (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; @@ -2391,12 +2729,12 @@ 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.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = summarizeForPolicyDefinitionDelegate(response); + ServiceResponse clientResponse = summarizeForPolicySetDefinitionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2405,7 +2743,7 @@ public Observable> call(Response summarizeForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + private ServiceResponse summarizeForPolicySetDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(QueryFailureException.class) @@ -2413,70 +2751,108 @@ private ServiceResponse summarizeForPolicyDefinitionDeleg } /** - * Queries policy states for the subscription level policy assignment. + * 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 policyAssignmentName Policy assignment name. + * @param policyDefinitionName Policy definition name. * @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 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(); + } + }; } /** - * Queries policy states for the subscription level policy assignment. + * 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 policyAssignmentName Policy assignment name. + * @param policyDefinitionName Policy definition name. * @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 listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName), 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); } /** - * Queries policy states for the subscription level policy assignment. + * 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 policyAssignmentName Policy assignment name. + * @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 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> 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 assignment. + * 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 policyAssignmentName Policy assignment name. + * @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)); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + 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."); } 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 (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } final String authorizationNamespace = "Microsoft.Authorization"; final String apiVersion = "2019-10-01"; @@ -2488,13 +2864,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.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, 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 = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2503,74 +2880,113 @@ public Observable> call(Response< } /** - * Queries policy states for the subscription level policy assignment. + * 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 policyAssignmentName Policy assignment name. + * @param policyDefinitionName Policy definition name. * @param queryOptions Additional parameters for the 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 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 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(); + } + }; } /** - * Queries policy states for the subscription level policy assignment. + * 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 policyAssignmentName Policy assignment name. + * @param policyDefinitionName Policy definition name. * @param queryOptions Additional parameters for the operation * @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 listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, 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); } /** - * Queries policy states for the subscription level policy assignment. + * 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 policyAssignmentName Policy assignment name. + * @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 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> 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(); + } + }); } /** - * Queries policy states for the subscription level policy assignment. + * 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 policyAssignmentName Policy assignment name. + * @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>> 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> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, 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."); } 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 (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } Validator.validate(queryOptions); final String authorizationNamespace = "Microsoft.Authorization"; @@ -2603,13 +3019,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.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, 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 = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2617,50 +3037,50 @@ 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> 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); } /** - * Summarizes policy states for the subscription level policy assignment. + * Summarizes policy states for the subscription level policy definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyAssignmentName Policy assignment name. + * @param policyDefinitionName Policy definition name. * @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 SummarizeResultsInner object if successful. */ - public SummarizeResultsInner summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName) { - return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).toBlocking().single().body(); + public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName) { + return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).toBlocking().single().body(); } /** - * Summarizes policy states for the subscription level policy assignment. + * Summarizes policy states for the subscription level policy definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyAssignmentName Policy assignment name. + * @param policyDefinitionName Policy definition name. * @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 summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName), serviceCallback); + public ServiceFuture summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName), serviceCallback); } /** - * Summarizes policy states for the subscription level policy assignment. + * Summarizes policy states for the subscription level policy definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyAssignmentName Policy assignment name. + * @param policyDefinitionName Policy definition name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the SummarizeResultsInner object */ - public Observable summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { - return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1, SummarizeResultsInner>() { + public Observable summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { + return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).map(new Func1, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse response) { return response.body(); @@ -2669,19 +3089,19 @@ public SummarizeResultsInner call(ServiceResponse respons } /** - * Summarizes policy states for the subscription level policy assignment. + * Summarizes policy states for the subscription level policy definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyAssignmentName Policy assignment name. + * @param policyDefinitionName Policy definition name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the SummarizeResultsInner object */ - public Observable> summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName) { + public Observable> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { 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 (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } final String policyStatesSummaryResource = "latest"; final String authorizationNamespace = "Microsoft.Authorization"; @@ -2691,12 +3111,12 @@ public Observable> summarizeForSubscripti 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.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = summarizeForSubscriptionLevelPolicyAssignmentDelegate(response); + ServiceResponse clientResponse = summarizeForPolicyDefinitionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2706,45 +3126,45 @@ public Observable> call(Response summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions), serviceCallback); + public ServiceFuture summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions), serviceCallback); } /** - * Summarizes policy states for the subscription level policy assignment. + * Summarizes policy states for the subscription level policy definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyAssignmentName Policy assignment name. + * @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 SummarizeResultsInner object */ - public Observable summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { - return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).map(new Func1, SummarizeResultsInner>() { + public Observable summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).map(new Func1, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse response) { return response.body(); @@ -2753,20 +3173,20 @@ public SummarizeResultsInner call(ServiceResponse respons } /** - * Summarizes policy states for the subscription level policy assignment. + * Summarizes policy states for the subscription level policy definition. * * @param subscriptionId Microsoft Azure subscription ID. - * @param policyAssignmentName Policy assignment name. + * @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 SummarizeResultsInner object */ - public Observable> summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + public Observable> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName, 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 (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } Validator.validate(queryOptions); final String policyStatesSummaryResource = "latest"; @@ -2788,12 +3208,12 @@ 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.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = summarizeForSubscriptionLevelPolicyAssignmentDelegate(response); + ServiceResponse clientResponse = summarizeForPolicyDefinitionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2802,7 +3222,7 @@ public Observable> call(Response summarizeForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + private ServiceResponse summarizeForPolicyDefinitionDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(QueryFailureException.class) @@ -2810,74 +3230,105 @@ private ServiceResponse summarizeForSubscriptionLevelPoli } /** - * Queries policy states for the resource group level policy assignment. + * 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 resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @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 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(); + } + }; } /** - * Queries policy states for the resource group level policy assignment. + * 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 resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @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 listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + public ServiceFuture> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Queries policy states for the resource group level policy assignment. + * 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 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> 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 resource group level policy assignment. + * 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 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> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { - 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."); + 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)); + } + }); + } + + /** + * 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 PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + 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."); } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + 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."); @@ -2892,13 +3343,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.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2907,79 +3359,111 @@ public Observable> call(Response< } /** - * Queries policy states for the resource group level policy assignment. + * 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 resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @param queryOptions Additional parameters for the 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 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 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(); + } + }; } /** - * Queries policy states for the resource group level policy assignment. + * 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 resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @param queryOptions Additional parameters for the operation * @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 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> 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); } /** - * Queries policy states for the resource group level policy assignment. + * 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 resourceGroupName Resource group name. * @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> 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(); + } + }); } /** - * Queries policy states for the resource group level policy assignment. + * 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 resourceGroupName Resource group name. * @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>> 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> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, 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."); } 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 (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } @@ -3014,13 +3498,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.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -3028,53 +3516,50 @@ 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> 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); } /** - * Summarizes policy states for the resource group level policy assignment. + * Summarizes policy states for the subscription 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 * @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 SummarizeResultsInner object if successful. */ - public SummarizeResultsInner summarizeForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().body(); + public SummarizeResultsInner summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName) { + return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).toBlocking().single().body(); } /** - * Summarizes policy states for the resource group level policy assignment. + * Summarizes policy states for the subscription level policy assignment. * * @param subscriptionId Microsoft Azure subscription ID. - * @param resourceGroupName Resource group name. * @param policyAssignmentName Policy assignment name. * @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 summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + public ServiceFuture summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName), serviceCallback); } /** - * Summarizes policy states for the resource group level policy assignment. + * Summarizes policy states for the subscription 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 SummarizeResultsInner object */ - public Observable summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { - return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1, SummarizeResultsInner>() { + public Observable summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { + return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse response) { return response.body(); @@ -3083,21 +3568,17 @@ public SummarizeResultsInner call(ServiceResponse respons } /** - * Summarizes policy states for the resource group level policy assignment. + * Summarizes policy states for the subscription 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 SummarizeResultsInner object */ - public Observable> summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + public Observable> summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName) { 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 (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } @@ -3109,12 +3590,12 @@ public Observable> summarizeForResourceGr 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.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = summarizeForResourceGroupLevelPolicyAssignmentDelegate(response); + ServiceResponse clientResponse = summarizeForSubscriptionLevelPolicyAssignmentDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3124,10 +3605,9 @@ public Observable> call(Response> call(Response summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), serviceCallback); + public ServiceFuture summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions), serviceCallback); } /** - * Summarizes policy states for the resource group level policy assignment. + * Summarizes policy states for the subscription level policy assignment. * * @param subscriptionId Microsoft Azure subscription ID. - * @param resourceGroupName Resource group name. * @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 SummarizeResultsInner object */ - public Observable summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { - return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).map(new Func1, SummarizeResultsInner>() { + public Observable summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).map(new Func1, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse response) { return response.body(); @@ -3174,22 +3652,18 @@ public SummarizeResultsInner call(ServiceResponse respons } /** - * Summarizes policy states for the resource group level policy assignment. + * Summarizes policy states for the subscription level policy assignment. * * @param subscriptionId Microsoft Azure subscription ID. - * @param resourceGroupName Resource group name. * @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 SummarizeResultsInner object */ - public Observable> summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + public Observable> summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName, 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 (policyAssignmentName == null) { throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } @@ -3213,12 +3687,12 @@ 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.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = summarizeForResourceGroupLevelPolicyAssignmentDelegate(response); + ServiceResponse clientResponse = summarizeForSubscriptionLevelPolicyAssignmentDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3227,11 +3701,1408 @@ public Observable> call(Response summarizeForResourceGroupLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + private ServiceResponse summarizeForSubscriptionLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().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 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 + * @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 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(); + } + }; + } + + /** + * 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. + * @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> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyStateInner> object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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)); + } + }); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> 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."); + } + 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 (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + DateTime to = null; + String filter = null; + String apply = null; + String skipToken = null; + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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); + } + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the 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 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(); + } + }; + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @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> 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); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyStateInner> object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions) + .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. + * @param queryOptions Additional parameters for the operation + * @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, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceGroupLevelPolicyAssignmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + ServiceResponse> * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param policyAssignmentName Policy assignment name. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyStateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync(final PolicyStatesResource policyStatesResource, final String subscriptionId, final String resourceGroupName, final String policyAssignmentName, final QueryOptions queryOptions) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + 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 (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String orderBy = null; + if (queryOptions != null) { + orderBy = queryOptions.orderBy(); + } + String select = null; + if (queryOptions != null) { + select = queryOptions.select(); + } + DateTime from = null; + if (queryOptions != null) { + from = queryOptions.from(); + } + DateTime to = null; + if (queryOptions != null) { + to = queryOptions.to(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + String skipToken = null; + if (queryOptions != null) { + skipToken = queryOptions.skipToken(); + } + return service.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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); + } + + /** + * Summarizes policy states 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 + * @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 SummarizeResultsInner object if successful. + */ + public SummarizeResultsInner summarizeForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @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 summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + 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 (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param queryOptions Additional parameters for the 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 SummarizeResultsInner object if successful. + */ + public SummarizeResultsInner summarizeForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param queryOptions Additional parameters for the operation + * @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 summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @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 SummarizeResultsInner object + */ + public Observable summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, 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 (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + DateTime from = null; + if (queryOptions != null) { + from = queryOptions.from(); + } + DateTime to = null; + if (queryOptions != null) { + to = queryOptions.to(); + } + String filter = null; + 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForResourceGroupLevelPolicyAssignmentDelegate(Response response) throws QueryFailureException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(QueryFailureException.class) + .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-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/RemediationImpl.java b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/RemediationImpl.java index 396ef9972bc6..344735d7ea61 100644 --- a/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/RemediationImpl.java +++ b/sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/RemediationImpl.java @@ -127,7 +127,7 @@ public String type() { } @Override - public RemediationImpl withExistingManagementGroupId(String managementGroupId) { + public RemediationImpl withExistingMicrosoft.PolicyInsight(String managementGroupId) { this.managementGroupId = managementGroupId; return this; }