diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorDefinition.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorDefinition.java new file mode 100644 index 000000000000..0e51af6cab78 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorDefinition.java @@ -0,0 +1,94 @@ +/** + * 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; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error definition. + */ +public class ErrorDefinition { + /** + * Service specific error code which serves as the substatus for the HTTP + * error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Description of the error. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Internal error details. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * Additional scenario specific error details. + */ + @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY) + private List additionalInfo; + + /** + * Get service specific error code which serves as the substatus for the HTTP error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get description of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get internal error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Get additional scenario specific error details. + * + * @return the additionalInfo value + */ + public List additionalInfo() { + return this.additionalInfo; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorResponse.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorResponse.java new file mode 100644 index 000000000000..2b9d96de0a05 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorResponse.java @@ -0,0 +1,43 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response. + */ +public class ErrorResponse { + /** + * The error details. + */ + @JsonProperty(value = "error") + private ErrorDefinition error; + + /** + * Get the error details. + * + * @return the error value + */ + public ErrorDefinition error() { + return this.error; + } + + /** + * Set the error details. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDefinition error) { + this.error = error; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorResponseException.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorResponseException.java new file mode 100644 index 000000000000..588658bb754f --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/ErrorResponseException.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; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/OperationDisplay.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/OperationDisplay.java new file mode 100644 index 000000000000..8d7d27370bcb --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Resource provider name. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource name on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation name. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Operation description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get resource provider name. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set resource provider name. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource name on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource name on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation name. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set operation description. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyAssignmentSummary.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyAssignmentSummary.java new file mode 100644 index 000000000000..d8423696ba2b --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyAssignmentSummary.java @@ -0,0 +1,122 @@ +/** + * 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; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy assignment summary. + */ +public class PolicyAssignmentSummary { + /** + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /** + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /** + * Non-compliance summary for the policy assignment. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /** + * Policy definitions summary. + */ + @JsonProperty(value = "policyDefinitions") + private List policyDefinitions; + + /** + * Get policy assignment ID. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get non-compliance summary for the policy assignment. + * + * @return the results value + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set non-compliance summary for the policy assignment. + * + * @param results the results value to set + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withResults(SummaryResults results) { + this.results = results; + return this; + } + + /** + * Get policy definitions summary. + * + * @return the policyDefinitions value + */ + public List policyDefinitions() { + return this.policyDefinitions; + } + + /** + * Set policy definitions summary. + * + * @param policyDefinitions the policyDefinitions value to set + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicyDefinitions(List policyDefinitions) { + this.policyDefinitions = policyDefinitions; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyDefinitionSummary.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyDefinitionSummary.java new file mode 100644 index 000000000000..16a387c20d67 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyDefinitionSummary.java @@ -0,0 +1,121 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy definition summary. + */ +public class PolicyDefinitionSummary { + /** + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /** + * Policy definition reference ID. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * Policy effect, i.e. policy definition action. + */ + @JsonProperty(value = "effect") + private String effect; + + /** + * Non-compliance summary for the policy definition. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /** + * Get policy definition ID. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get policy definition reference ID. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set policy definition reference ID. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get policy effect, i.e. policy definition action. + * + * @return the effect value + */ + public String effect() { + return this.effect; + } + + /** + * Set policy effect, i.e. policy definition action. + * + * @param effect the effect value to set + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withEffect(String effect) { + this.effect = effect; + return this; + } + + /** + * Get non-compliance summary for the policy definition. + * + * @return the results value + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set non-compliance summary for the policy definition. + * + * @param results the results value to set + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withResults(SummaryResults results) { + this.results = results; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyDetails.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyDetails.java new file mode 100644 index 000000000000..6c54581033cb --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyDetails.java @@ -0,0 +1,107 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy details. + */ +public class PolicyDetails { + /** + * The ID of the policy definition. + */ + @JsonProperty(value = "policyDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionId; + + /** + * The ID of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentId", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentId; + + /** + * The display name of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentDisplayName; + + /** + * The scope of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentScope", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentScope; + + /** + * The ID of the policy set definition. + */ + @JsonProperty(value = "policySetDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policySetDefinitionId; + + /** + * The policy definition reference ID within the policy set definition. + */ + @JsonProperty(value = "policyDefinitionReferenceId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionReferenceId; + + /** + * Get the ID of the policy definition. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Get the ID of the policy assignment. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Get the display name of the policy assignment. + * + * @return the policyAssignmentDisplayName value + */ + public String policyAssignmentDisplayName() { + return this.policyAssignmentDisplayName; + } + + /** + * Get the scope of the policy assignment. + * + * @return the policyAssignmentScope value + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Get the ID of the policy set definition. + * + * @return the policySetDefinitionId value + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Get the policy definition reference ID within the policy set definition. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyStatesResource.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyStatesResource.java new file mode 100644 index 000000000000..228535142af5 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/PolicyStatesResource.java @@ -0,0 +1,41 @@ +/** + * 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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyStatesResource. + */ +public final class PolicyStatesResource extends ExpandableStringEnum { + /** Static value default for PolicyStatesResource. */ + public static final PolicyStatesResource DEFAULT = fromString("default"); + + /** Static value latest for PolicyStatesResource. */ + public static final PolicyStatesResource LATEST = fromString("latest"); + + /** + * Creates or finds a PolicyStatesResource from its string representation. + * @param name a name to look for + * @return the corresponding PolicyStatesResource + */ + @JsonCreator + public static PolicyStatesResource fromString(String name) { + return fromString(name, PolicyStatesResource.class); + } + + /** + * @return known PolicyStatesResource values + */ + public static Collection values() { + return values(PolicyStatesResource.class); + } +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailure.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailure.java new file mode 100644 index 000000000000..39b0e27c7f4d --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailure.java @@ -0,0 +1,43 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response. + */ +public class QueryFailure { + /** + * Error definition. + */ + @JsonProperty(value = "error") + private QueryFailureError error; + + /** + * Get error definition. + * + * @return the error value + */ + public QueryFailureError error() { + return this.error; + } + + /** + * Set error definition. + * + * @param error the error value to set + * @return the QueryFailure object itself. + */ + public QueryFailure withError(QueryFailureError error) { + this.error = error; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailureError.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailureError.java new file mode 100644 index 000000000000..1fcaffed9673 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailureError.java @@ -0,0 +1,48 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error definition. + */ +public class QueryFailureError { + /** + * Service specific error code which serves as the substatus for the HTTP + * error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Description of the error. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get service specific error code which serves as the substatus for the HTTP error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get description of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailureException.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailureException.java new file mode 100644 index 000000000000..152c0eab7f51 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryFailureException.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; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with QueryFailure information. + */ +public class QueryFailureException extends RestException { + /** + * Initializes a new instance of the QueryFailureException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public QueryFailureException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the QueryFailureException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public QueryFailureException(final String message, final Response response, final QueryFailure body) { + super(message, response, body); + } + + @Override + public QueryFailure body() { + return (QueryFailure) super.body(); + } +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryOptions.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryOptions.java new file mode 100644 index 000000000000..ac0de50d62f9 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/QueryOptions.java @@ -0,0 +1,206 @@ +/** + * 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; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for a set of operations. + */ +public class QueryOptions { + /** + * Maximum number of records to return. + */ + @JsonProperty(value = "") + private Integer top; + + /** + * OData filter expression. + */ + @JsonProperty(value = "") + private String filter; + + /** + * Ordering expression using OData notation. One or more comma-separated + * column names with an optional "desc" (the default) or "asc", e.g. + * "$orderby=PolicyAssignmentId, ResourceId asc". + */ + @JsonProperty(value = "") + private String orderBy; + + /** + * Select expression using OData notation. Limits the columns on each + * record to just those requested, e.g. "$select=PolicyAssignmentId, + * ResourceId". + */ + @JsonProperty(value = "") + private String select; + + /** + * ISO 8601 formatted timestamp specifying the start time of the interval + * to query. When not specified, the service uses ($to - 1-day). + */ + @JsonProperty(value = "") + private DateTime from; + + /** + * ISO 8601 formatted timestamp specifying the end time of the interval to + * query. When not specified, the service uses request time. + */ + @JsonProperty(value = "") + private DateTime to; + + /** + * OData apply expression for aggregations. + */ + @JsonProperty(value = "") + private String apply; + + /** + * Get maximum number of records to return. + * + * @return the top value + */ + public Integer top() { + return this.top; + } + + /** + * Set maximum number of records to return. + * + * @param top the top value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withTop(Integer top) { + this.top = top; + return this; + } + + /** + * Get oData filter expression. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set oData filter expression. + * + * @param filter the filter value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * + * @return the orderBy value + */ + public String orderBy() { + return this.orderBy; + } + + /** + * Set ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * + * @param orderBy the orderBy value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Get select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + * + * @param select the select value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get iSO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + * + * @return the from value + */ + public DateTime from() { + return this.from; + } + + /** + * Set iSO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + * + * @param from the from value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withFrom(DateTime from) { + this.from = from; + return this; + } + + /** + * Get iSO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + * + * @return the to value + */ + public DateTime to() { + return this.to; + } + + /** + * Set iSO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + * + * @param to the to value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withTo(DateTime to) { + this.to = to; + return this; + } + + /** + * Get oData apply expression for aggregations. + * + * @return the apply value + */ + public String apply() { + return this.apply; + } + + /** + * Set oData apply expression for aggregations. + * + * @param apply the apply value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withApply(String apply) { + this.apply = apply; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/RemediationDeploymentSummary.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/RemediationDeploymentSummary.java new file mode 100644 index 000000000000..b1b71f0146ed --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/RemediationDeploymentSummary.java @@ -0,0 +1,97 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The deployment status summary for all deplyoments created by the + * remediation. + */ +public class RemediationDeploymentSummary { + /** + * The number of deployments required by the remediation. + */ + @JsonProperty(value = "totalDeployments") + private Integer totalDeployments; + + /** + * The number of deployments required by the remediation that have + * succeeded. + */ + @JsonProperty(value = "successfulDeployments") + private Integer successfulDeployments; + + /** + * The number of deployments required by the remediation that have failed. + */ + @JsonProperty(value = "failedDeployments") + private Integer failedDeployments; + + /** + * Get the number of deployments required by the remediation. + * + * @return the totalDeployments value + */ + public Integer totalDeployments() { + return this.totalDeployments; + } + + /** + * Set the number of deployments required by the remediation. + * + * @param totalDeployments the totalDeployments value to set + * @return the RemediationDeploymentSummary object itself. + */ + public RemediationDeploymentSummary withTotalDeployments(Integer totalDeployments) { + this.totalDeployments = totalDeployments; + return this; + } + + /** + * Get the number of deployments required by the remediation that have succeeded. + * + * @return the successfulDeployments value + */ + public Integer successfulDeployments() { + return this.successfulDeployments; + } + + /** + * Set the number of deployments required by the remediation that have succeeded. + * + * @param successfulDeployments the successfulDeployments value to set + * @return the RemediationDeploymentSummary object itself. + */ + public RemediationDeploymentSummary withSuccessfulDeployments(Integer successfulDeployments) { + this.successfulDeployments = successfulDeployments; + return this; + } + + /** + * Get the number of deployments required by the remediation that have failed. + * + * @return the failedDeployments value + */ + public Integer failedDeployments() { + return this.failedDeployments; + } + + /** + * Set the number of deployments required by the remediation that have failed. + * + * @param failedDeployments the failedDeployments value to set + * @return the RemediationDeploymentSummary object itself. + */ + public RemediationDeploymentSummary withFailedDeployments(Integer failedDeployments) { + this.failedDeployments = failedDeployments; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/RemediationFilters.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/RemediationFilters.java new file mode 100644 index 000000000000..40b957a1c8cb --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/RemediationFilters.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; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The filters that will be applied to determine which resources to remediate. + */ +public class RemediationFilters { + /** + * The resource locations that will be remediated. + */ + @JsonProperty(value = "locations") + private List locations; + + /** + * Get the resource locations that will be remediated. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set the resource locations that will be remediated. + * + * @param locations the locations value to set + * @return the RemediationFilters object itself. + */ + public RemediationFilters withLocations(List locations) { + this.locations = locations; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/Summary.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/Summary.java new file mode 100644 index 000000000000..29a75b9232fb --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/Summary.java @@ -0,0 +1,124 @@ +/** + * 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; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Summary results. + */ +public class Summary { + /** + * OData entity ID; always set to null since summaries do not have an + * entity ID. + */ + @JsonProperty(value = "@odata\\.id") + private String odataid; + + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * Non-compliance summary for all policy assignments. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /** + * Policy assignments summary. + */ + @JsonProperty(value = "policyAssignments") + private List policyAssignments; + + /** + * Get oData entity ID; always set to null since summaries do not have an entity ID. + * + * @return the odataid value + */ + public String odataid() { + return this.odataid; + } + + /** + * Set oData entity ID; always set to null since summaries do not have an entity ID. + * + * @param odataid the odataid value to set + * @return the Summary object itself. + */ + public Summary withOdataid(String odataid) { + this.odataid = odataid; + return this; + } + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the Summary object itself. + */ + public Summary withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get non-compliance summary for all policy assignments. + * + * @return the results value + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set non-compliance summary for all policy assignments. + * + * @param results the results value to set + * @return the Summary object itself. + */ + public Summary withResults(SummaryResults results) { + this.results = results; + return this; + } + + /** + * Get policy assignments summary. + * + * @return the policyAssignments value + */ + public List policyAssignments() { + return this.policyAssignments; + } + + /** + * Set policy assignments summary. + * + * @param policyAssignments the policyAssignments value to set + * @return the Summary object itself. + */ + public Summary withPolicyAssignments(List policyAssignments) { + this.policyAssignments = policyAssignments; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/SummaryResults.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/SummaryResults.java new file mode 100644 index 000000000000..012a14b81c6e --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/SummaryResults.java @@ -0,0 +1,96 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Non-compliance summary on a particular summary level. + */ +public class SummaryResults { + /** + * HTTP POST URI for queryResults action on Microsoft.PolicyInsights to + * retrieve raw results for the non-compliance summary. + */ + @JsonProperty(value = "queryResultsUri") + private String queryResultsUri; + + /** + * Number of non-compliant resources. + */ + @JsonProperty(value = "nonCompliantResources") + private Integer nonCompliantResources; + + /** + * Number of non-compliant policies. + */ + @JsonProperty(value = "nonCompliantPolicies") + private Integer nonCompliantPolicies; + + /** + * Get hTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the non-compliance summary. + * + * @return the queryResultsUri value + */ + public String queryResultsUri() { + return this.queryResultsUri; + } + + /** + * Set hTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the non-compliance summary. + * + * @param queryResultsUri the queryResultsUri value to set + * @return the SummaryResults object itself. + */ + public SummaryResults withQueryResultsUri(String queryResultsUri) { + this.queryResultsUri = queryResultsUri; + return this; + } + + /** + * Get number of non-compliant resources. + * + * @return the nonCompliantResources value + */ + public Integer nonCompliantResources() { + return this.nonCompliantResources; + } + + /** + * Set number of non-compliant resources. + * + * @param nonCompliantResources the nonCompliantResources value to set + * @return the SummaryResults object itself. + */ + public SummaryResults withNonCompliantResources(Integer nonCompliantResources) { + this.nonCompliantResources = nonCompliantResources; + return this; + } + + /** + * Get number of non-compliant policies. + * + * @return the nonCompliantPolicies value + */ + public Integer nonCompliantPolicies() { + return this.nonCompliantPolicies; + } + + /** + * Set number of non-compliant policies. + * + * @param nonCompliantPolicies the nonCompliantPolicies value to set + * @return the SummaryResults object itself. + */ + public SummaryResults withNonCompliantPolicies(Integer nonCompliantPolicies) { + this.nonCompliantPolicies = nonCompliantPolicies; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/TrackedResourceModificationDetails.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/TrackedResourceModificationDetails.java new file mode 100644 index 000000000000..fd5ca60d3447 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/TrackedResourceModificationDetails.java @@ -0,0 +1,65 @@ +/** + * 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; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the policy triggered deployment that created or modified the + * tracked resource. + */ +public class TrackedResourceModificationDetails { + /** + * The details of the policy that created or modified the tracked resource. + */ + @JsonProperty(value = "policyDetails", access = JsonProperty.Access.WRITE_ONLY) + private PolicyDetails policyDetails; + + /** + * The ID of the deployment that created or modified the tracked resource. + */ + @JsonProperty(value = "deploymentId", access = JsonProperty.Access.WRITE_ONLY) + private String deploymentId; + + /** + * Timestamp of the deployment that created or modified the tracked + * resource. + */ + @JsonProperty(value = "deploymentTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime deploymentTime; + + /** + * Get the details of the policy that created or modified the tracked resource. + * + * @return the policyDetails value + */ + public PolicyDetails policyDetails() { + return this.policyDetails; + } + + /** + * Get the ID of the deployment that created or modified the tracked resource. + * + * @return the deploymentId value + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Get timestamp of the deployment that created or modified the tracked resource. + * + * @return the deploymentTime value + */ + public DateTime deploymentTime() { + return this.deploymentTime; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/TypedErrorInfo.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/TypedErrorInfo.java new file mode 100644 index 000000000000..83536f1de602 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/TypedErrorInfo.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Scenario specific error details. + */ +public class TypedErrorInfo { + /** + * The type of included error details. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The scenario specific error details. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type of included error details. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the scenario specific error details. + * + * @return the info value + */ + public Object info() { + return this.info; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationInner.java new file mode 100644 index 000000000000..ccdfd2e65228 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.policyinsights.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation definition. + */ +public class OperationInner { + /** + * Operation name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get display metadata associated with the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set display metadata associated with the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationsInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationsInner.java new file mode 100644 index 000000000000..45eea7d743a1 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationsInner.java @@ -0,0 +1,126 @@ +/** + * 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.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.policyinsights.QueryFailureException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.Operations list" }) + @GET("providers/Microsoft.PolicyInsights/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists available operations. + * + * @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 OperationsListResultsInner object if successful. + */ + public OperationsListResultsInner list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists available operations. + * + * @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 ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists available operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationsListResultsInner object + */ + public Observable listAsync() { + return listWithServiceResponseAsync().map(new Func1, OperationsListResultsInner>() { + @Override + public OperationsListResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists available operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationsListResultsInner object + */ + public Observable> listWithServiceResponseAsync() { + final String apiVersion = "2018-04-04"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws QueryFailureException, IOException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationsListResultsInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationsListResultsInner.java new file mode 100644 index 000000000000..f758f88f17bf --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/OperationsListResultsInner.java @@ -0,0 +1,70 @@ +/** + * 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.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * List of available operations. + */ +public class OperationsListResultsInner { + /** + * OData entity count; represents the number of operations returned. + */ + @JsonProperty(value = "@odata\\.count") + private Integer odatacount; + + /** + * List of available operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get oData entity count; represents the number of operations returned. + * + * @return the odatacount value + */ + public Integer odatacount() { + return this.odatacount; + } + + /** + * Set oData entity count; represents the number of operations returned. + * + * @param odatacount the odatacount value to set + * @return the OperationsListResultsInner object itself. + */ + public OperationsListResultsInner withOdatacount(Integer odatacount) { + this.odatacount = odatacount; + return this; + } + + /** + * Get list of available operations. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of available operations. + * + * @param value the value value to set + * @return the OperationsListResultsInner object itself. + */ + public OperationsListResultsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PageImpl.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PageImpl.java new file mode 100644 index 000000000000..a5960f2e62b9 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PageImpl.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.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 PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("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 PageImpl 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 PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventInner.java new file mode 100644 index 000000000000..692b965acbe3 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventInner.java @@ -0,0 +1,809 @@ +/** + * 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.implementation; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy event record. + */ +public class PolicyEventInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * OData entity ID; always set to null since policy event records do not + * have an entity ID. + */ + @JsonProperty(value = "@odata\\.id") + private String odataid; + + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * Timestamp for the policy event record. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Resource ID. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /** + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /** + * Effective parameters for the policy assignment. + */ + @JsonProperty(value = "effectiveParameters") + private String effectiveParameters; + + /** + * Flag which states whether the resource is compliant against the policy + * assignment it was evaluated against. + */ + @JsonProperty(value = "isCompliant") + private Boolean isCompliant; + + /** + * Subscription ID. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * Resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * Resource location. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /** + * Resource group name. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * List of resource tags. + */ + @JsonProperty(value = "resourceTags") + private String resourceTags; + + /** + * Policy assignment name. + */ + @JsonProperty(value = "policyAssignmentName") + private String policyAssignmentName; + + /** + * Policy assignment owner. + */ + @JsonProperty(value = "policyAssignmentOwner") + private String policyAssignmentOwner; + + /** + * Policy assignment parameters. + */ + @JsonProperty(value = "policyAssignmentParameters") + private String policyAssignmentParameters; + + /** + * Policy assignment scope. + */ + @JsonProperty(value = "policyAssignmentScope") + private String policyAssignmentScope; + + /** + * Policy definition name. + */ + @JsonProperty(value = "policyDefinitionName") + private String policyDefinitionName; + + /** + * Policy definition action, i.e. effect. + */ + @JsonProperty(value = "policyDefinitionAction") + private String policyDefinitionAction; + + /** + * Policy definition category. + */ + @JsonProperty(value = "policyDefinitionCategory") + private String policyDefinitionCategory; + + /** + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /** + * Policy set definition name, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionName") + private String policySetDefinitionName; + + /** + * Policy set definition owner, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionOwner") + private String policySetDefinitionOwner; + + /** + * Policy set definition category, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionCategory") + private String policySetDefinitionCategory; + + /** + * Policy set definition parameters, if the policy assignment is for a + * policy set. + */ + @JsonProperty(value = "policySetDefinitionParameters") + private String policySetDefinitionParameters; + + /** + * Comma seperated list of management group IDs, which represent the + * hierarchy of the management groups the resource is under. + */ + @JsonProperty(value = "managementGroupIds") + private String managementGroupIds; + + /** + * Reference ID for the policy definition inside the policy set, if the + * policy assignment is for a policy set. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * Tenant ID for the policy event record. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Principal object ID for the user who initiated the resource operation + * that triggered the policy event. + */ + @JsonProperty(value = "principalOid") + private String principalOid; + + /** + * 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 PolicyEventInner object itself. + */ + public PolicyEventInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get oData entity ID; always set to null since policy event records do not have an entity ID. + * + * @return the odataid value + */ + public String odataid() { + return this.odataid; + } + + /** + * Set oData entity ID; always set to null since policy event records do not have an entity ID. + * + * @param odataid the odataid value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withOdataid(String odataid) { + this.odataid = odataid; + return this; + } + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get timestamp for the policy event record. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set timestamp for the policy event record. + * + * @param timestamp the timestamp value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get resource ID. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set resource ID. + * + * @param resourceId the resourceId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get policy assignment ID. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get policy definition ID. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get effective parameters for the policy assignment. + * + * @return the effectiveParameters value + */ + public String effectiveParameters() { + return this.effectiveParameters; + } + + /** + * Set effective parameters for the policy assignment. + * + * @param effectiveParameters the effectiveParameters value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withEffectiveParameters(String effectiveParameters) { + this.effectiveParameters = effectiveParameters; + return this; + } + + /** + * Get flag which states whether the resource is compliant against the policy assignment it was evaluated against. + * + * @return the isCompliant value + */ + public Boolean isCompliant() { + return this.isCompliant; + } + + /** + * Set flag which states whether the resource is compliant against the policy assignment it was evaluated against. + * + * @param isCompliant the isCompliant value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withIsCompliant(Boolean isCompliant) { + this.isCompliant = isCompliant; + return this; + } + + /** + * Get subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set subscription ID. + * + * @param subscriptionId the subscriptionId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set resource type. + * + * @param resourceType the resourceType value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get resource location. + * + * @return the resourceLocation value + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set resource location. + * + * @param resourceLocation the resourceLocation value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get resource group name. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set resource group name. + * + * @param resourceGroup the resourceGroup value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get list of resource tags. + * + * @return the resourceTags value + */ + public String resourceTags() { + return this.resourceTags; + } + + /** + * Set list of resource tags. + * + * @param resourceTags the resourceTags value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceTags(String resourceTags) { + this.resourceTags = resourceTags; + return this; + } + + /** + * Get policy assignment name. + * + * @return the policyAssignmentName value + */ + public String policyAssignmentName() { + return this.policyAssignmentName; + } + + /** + * Set policy assignment name. + * + * @param policyAssignmentName the policyAssignmentName value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentName(String policyAssignmentName) { + this.policyAssignmentName = policyAssignmentName; + return this; + } + + /** + * Get policy assignment owner. + * + * @return the policyAssignmentOwner value + */ + public String policyAssignmentOwner() { + return this.policyAssignmentOwner; + } + + /** + * Set policy assignment owner. + * + * @param policyAssignmentOwner the policyAssignmentOwner value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentOwner(String policyAssignmentOwner) { + this.policyAssignmentOwner = policyAssignmentOwner; + return this; + } + + /** + * Get policy assignment parameters. + * + * @return the policyAssignmentParameters value + */ + public String policyAssignmentParameters() { + return this.policyAssignmentParameters; + } + + /** + * Set policy assignment parameters. + * + * @param policyAssignmentParameters the policyAssignmentParameters value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentParameters(String policyAssignmentParameters) { + this.policyAssignmentParameters = policyAssignmentParameters; + return this; + } + + /** + * Get policy assignment scope. + * + * @return the policyAssignmentScope value + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Set policy assignment scope. + * + * @param policyAssignmentScope the policyAssignmentScope value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentScope(String policyAssignmentScope) { + this.policyAssignmentScope = policyAssignmentScope; + return this; + } + + /** + * Get policy definition name. + * + * @return the policyDefinitionName value + */ + public String policyDefinitionName() { + return this.policyDefinitionName; + } + + /** + * Set policy definition name. + * + * @param policyDefinitionName the policyDefinitionName value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionName(String policyDefinitionName) { + this.policyDefinitionName = policyDefinitionName; + 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 PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionAction(String policyDefinitionAction) { + this.policyDefinitionAction = policyDefinitionAction; + return this; + } + + /** + * Get policy definition category. + * + * @return the policyDefinitionCategory value + */ + public String policyDefinitionCategory() { + return this.policyDefinitionCategory; + } + + /** + * Set policy definition category. + * + * @param policyDefinitionCategory the policyDefinitionCategory value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionCategory(String policyDefinitionCategory) { + this.policyDefinitionCategory = policyDefinitionCategory; + return this; + } + + /** + * Get policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get policy set definition name, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionName value + */ + public String policySetDefinitionName() { + return this.policySetDefinitionName; + } + + /** + * Set policy set definition name, if the policy assignment is for a policy set. + * + * @param policySetDefinitionName the policySetDefinitionName value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionName(String policySetDefinitionName) { + this.policySetDefinitionName = policySetDefinitionName; + return this; + } + + /** + * Get policy set definition owner, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionOwner value + */ + public String policySetDefinitionOwner() { + return this.policySetDefinitionOwner; + } + + /** + * Set policy set definition owner, if the policy assignment is for a policy set. + * + * @param policySetDefinitionOwner the policySetDefinitionOwner value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionOwner(String policySetDefinitionOwner) { + this.policySetDefinitionOwner = policySetDefinitionOwner; + return this; + } + + /** + * Get policy set definition category, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionCategory value + */ + public String policySetDefinitionCategory() { + return this.policySetDefinitionCategory; + } + + /** + * Set policy set definition category, if the policy assignment is for a policy set. + * + * @param policySetDefinitionCategory the policySetDefinitionCategory value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionCategory(String policySetDefinitionCategory) { + this.policySetDefinitionCategory = policySetDefinitionCategory; + return this; + } + + /** + * Get policy set definition parameters, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionParameters value + */ + public String policySetDefinitionParameters() { + return this.policySetDefinitionParameters; + } + + /** + * Set policy set definition parameters, if the policy assignment is for a policy set. + * + * @param policySetDefinitionParameters the policySetDefinitionParameters value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionParameters(String policySetDefinitionParameters) { + this.policySetDefinitionParameters = policySetDefinitionParameters; + return this; + } + + /** + * Get comma seperated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + * + * @return the managementGroupIds value + */ + public String managementGroupIds() { + return this.managementGroupIds; + } + + /** + * Set comma seperated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + * + * @param managementGroupIds the managementGroupIds value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withManagementGroupIds(String managementGroupIds) { + this.managementGroupIds = managementGroupIds; + return this; + } + + /** + * Get reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + 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 PolicyEventInner object itself. + */ + public PolicyEventInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get principal object ID for the user who initiated the resource 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 operation that triggered the policy event. + * + * @param principalOid the principalOid value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPrincipalOid(String principalOid) { + this.principalOid = principalOid; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventsInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventsInner.java new file mode 100644 index 000000000000..95ffaa6a2e31 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventsInner.java @@ -0,0 +1,1736 @@ +/** + * 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.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.policyinsights.QueryFailureException; +import com.microsoft.azure.management.policyinsights.QueryOptions; +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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyEvents. + */ +public class PolicyEventsInner { + /** The Retrofit service to perform REST calls. */ + private PolicyEventsService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyEventsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyEventsInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(PolicyEventsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyEvents to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyEventsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management 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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management 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 listQueryResultsForManagementGroupAsync(String managementGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName), serviceCallback); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner object + */ + public Observable listQueryResultsForManagementGroupAsync(String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(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 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.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, 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 = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group 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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName, QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group 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 listQueryResultsForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the resources under the management group. + * + * @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 + */ + public Observable listQueryResultsForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @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 + */ + public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(String managementGroupName, 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"; + 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.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, 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 = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForManagementGroupDelegate(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 events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 listQueryResultsForSubscriptionAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable listQueryResultsForSubscriptionAsync(String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(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 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.listQueryResultsForSubscription(policyEventsResource, subscriptionId, 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 = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 listQueryResultsForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @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 + */ + public Observable listQueryResultsForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @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 + */ + public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(String subscriptionId, 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"; + 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.listQueryResultsForSubscription(policyEventsResource, subscriptionId, 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 = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForSubscriptionDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName), 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(String subscriptionId, 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 policyEventsResource = "default"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, 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 = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + 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(); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, 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 policyEventsResource = "default"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, 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 = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceGroupDelegate(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 events for the resource. + * + * @param resourceId Resource ID. + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId).toBlocking().single().body(); + } + + /** + * Queries policy events for the 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 listQueryResultsForResourceAsync(String resourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(resourceId), serviceCallback); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner object + */ + public Observable listQueryResultsForResourceAsync(String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceWithServiceResponseAsync(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 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.listQueryResultsForResource(policyEventsResource, resourceId, 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 = listQueryResultsForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId, QueryOptions queryOptions) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the 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 listQueryResultsForResourceAsync(String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * Queries policy events for the 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceWithServiceResponseAsync(String resourceId, 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"; + 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.listQueryResultsForResource(policyEventsResource, resourceId, 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 = listQueryResultsForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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(policyEventsResource, 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); + } + } + }); + } + + private ServiceResponse listQueryResultsForPolicySetDefinitionDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName), serviceCallback); + } + + /** + * 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + 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(); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName, 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."); + } + Validator.validate(queryOptions); + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, 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 = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForPolicyDefinitionDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName), serviceCallback); + } + + /** + * 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + 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(); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName, 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."); + } + Validator.validate(queryOptions); + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().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. + * @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(String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + } + + /** + * 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(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 policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single().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. + * @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(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), serviceCallback); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(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 policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(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); + } + + /** + * 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 + * @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. + */ + public String getMetadata(String scope) { + return getMetadataWithServiceResponseAsync(scope).toBlocking().single().body(); + } + + /** + * 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. + * @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); + } + + /** + * 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 to the String object + */ + public Observable getMetadataAsync(String scope) { + return getMetadataWithServiceResponseAsync(scope).map(new Func1, String>() { + @Override + public String call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 to the String object + */ + public Observable> getMetadataWithServiceResponseAsync(String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + final String apiVersion = "2018-04-04"; + return service.getMetadata(scope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMetadataDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMetadataDelegate(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); + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventsQueryResultsInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventsQueryResultsInner.java new file mode 100644 index 000000000000..2c0b33eb32bf --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyEventsQueryResultsInner.java @@ -0,0 +1,98 @@ +/** + * 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.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Query results. + */ +public class PolicyEventsQueryResultsInner { + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * OData entity count; represents the number of policy event records + * returned. + */ + @JsonProperty(value = "@odata\\.count") + private Integer odatacount; + + /** + * Query results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the PolicyEventsQueryResultsInner object itself. + */ + public PolicyEventsQueryResultsInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get oData entity count; represents the number of policy event records returned. + * + * @return the odatacount value + */ + public Integer odatacount() { + return this.odatacount; + } + + /** + * Set oData entity count; represents the number of policy event records returned. + * + * @param odatacount the odatacount value to set + * @return the PolicyEventsQueryResultsInner object itself. + */ + public PolicyEventsQueryResultsInner withOdatacount(Integer odatacount) { + this.odatacount = odatacount; + return this; + } + + /** + * Get query results. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set query results. + * + * @param value the value value to set + * @return the PolicyEventsQueryResultsInner object itself. + */ + public PolicyEventsQueryResultsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyInsightsClientImpl.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyInsightsClientImpl.java new file mode 100644 index 000000000000..d0b630417e7c --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyInsightsClientImpl.java @@ -0,0 +1,216 @@ +/** + * 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.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the PolicyInsightsClientImpl class. + */ +public class PolicyInsightsClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public PolicyInsightsClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public PolicyInsightsClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public PolicyInsightsClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The PolicyTrackedResourcesInner object to access its operations. + */ + private PolicyTrackedResourcesInner policyTrackedResources; + + /** + * Gets the PolicyTrackedResourcesInner object to access its operations. + * @return the PolicyTrackedResourcesInner object. + */ + public PolicyTrackedResourcesInner policyTrackedResources() { + return this.policyTrackedResources; + } + + /** + * The RemediationsInner object to access its operations. + */ + private RemediationsInner remediations; + + /** + * Gets the RemediationsInner object to access its operations. + * @return the RemediationsInner object. + */ + public RemediationsInner remediations() { + return this.remediations; + } + + /** + * The PolicyEventsInner object to access its operations. + */ + private PolicyEventsInner policyEvents; + + /** + * Gets the PolicyEventsInner object to access its operations. + * @return the PolicyEventsInner object. + */ + public PolicyEventsInner policyEvents() { + return this.policyEvents; + } + + /** + * The PolicyStatesInner object to access its operations. + */ + private PolicyStatesInner policyStates; + + /** + * Gets the PolicyStatesInner object to access its operations. + * @return the PolicyStatesInner object. + */ + public PolicyStatesInner policyStates() { + return this.policyStates; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of PolicyInsightsClient client. + * + * @param credentials the management credentials for Azure + */ + public PolicyInsightsClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of PolicyInsightsClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public PolicyInsightsClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of PolicyInsightsClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public PolicyInsightsClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.policyTrackedResources = new PolicyTrackedResourcesInner(restClient().retrofit(), this); + this.remediations = new RemediationsInner(restClient().retrofit(), this); + this.policyEvents = new PolicyEventsInner(restClient().retrofit(), this); + this.policyStates = new PolicyStatesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s)", super.userAgent(), "PolicyInsightsClient"); + } +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStateInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStateInner.java new file mode 100644 index 000000000000..4da8dd291980 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStateInner.java @@ -0,0 +1,756 @@ +/** + * 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.implementation; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy state record. + */ +public class PolicyStateInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * OData entity ID; always set to null since policy state records do not + * have an entity ID. + */ + @JsonProperty(value = "@odata\\.id") + private String odataid; + + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * Timestamp for the policy state record. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Resource ID. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /** + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /** + * Effective parameters for the policy assignment. + */ + @JsonProperty(value = "effectiveParameters") + private String effectiveParameters; + + /** + * Flag which states whether the resource is compliant against the policy + * assignment it was evaluated against. + */ + @JsonProperty(value = "isCompliant") + private Boolean isCompliant; + + /** + * Subscription ID. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * Resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * Resource location. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /** + * Resource group name. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * List of resource tags. + */ + @JsonProperty(value = "resourceTags") + private String resourceTags; + + /** + * Policy assignment name. + */ + @JsonProperty(value = "policyAssignmentName") + private String policyAssignmentName; + + /** + * Policy assignment owner. + */ + @JsonProperty(value = "policyAssignmentOwner") + private String policyAssignmentOwner; + + /** + * Policy assignment parameters. + */ + @JsonProperty(value = "policyAssignmentParameters") + private String policyAssignmentParameters; + + /** + * Policy assignment scope. + */ + @JsonProperty(value = "policyAssignmentScope") + private String policyAssignmentScope; + + /** + * Policy definition name. + */ + @JsonProperty(value = "policyDefinitionName") + private String policyDefinitionName; + + /** + * Policy definition action, i.e. effect. + */ + @JsonProperty(value = "policyDefinitionAction") + private String policyDefinitionAction; + + /** + * Policy definition category. + */ + @JsonProperty(value = "policyDefinitionCategory") + private String policyDefinitionCategory; + + /** + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /** + * Policy set definition name, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionName") + private String policySetDefinitionName; + + /** + * Policy set definition owner, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionOwner") + private String policySetDefinitionOwner; + + /** + * Policy set definition category, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionCategory") + private String policySetDefinitionCategory; + + /** + * Policy set definition parameters, if the policy assignment is for a + * policy set. + */ + @JsonProperty(value = "policySetDefinitionParameters") + private String policySetDefinitionParameters; + + /** + * Comma seperated list of management group IDs, which represent the + * hierarchy of the management groups the resource is under. + */ + @JsonProperty(value = "managementGroupIds") + private String managementGroupIds; + + /** + * Reference ID for the policy definition inside the policy set, if the + * policy assignment is for a policy set. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * 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 PolicyStateInner object itself. + */ + public PolicyStateInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get oData entity ID; always set to null since policy state records do not have an entity ID. + * + * @return the odataid value + */ + public String odataid() { + return this.odataid; + } + + /** + * Set oData entity ID; always set to null since policy state records do not have an entity ID. + * + * @param odataid the odataid value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withOdataid(String odataid) { + this.odataid = odataid; + return this; + } + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get timestamp for the policy state record. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set timestamp for the policy state record. + * + * @param timestamp the timestamp value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get resource ID. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set resource ID. + * + * @param resourceId the resourceId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get policy assignment ID. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get policy definition ID. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get effective parameters for the policy assignment. + * + * @return the effectiveParameters value + */ + public String effectiveParameters() { + return this.effectiveParameters; + } + + /** + * Set effective parameters for the policy assignment. + * + * @param effectiveParameters the effectiveParameters value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withEffectiveParameters(String effectiveParameters) { + this.effectiveParameters = effectiveParameters; + return this; + } + + /** + * Get flag which states whether the resource is compliant against the policy assignment it was evaluated against. + * + * @return the isCompliant value + */ + public Boolean isCompliant() { + return this.isCompliant; + } + + /** + * Set flag which states whether the resource is compliant against the policy assignment it was evaluated against. + * + * @param isCompliant the isCompliant value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withIsCompliant(Boolean isCompliant) { + this.isCompliant = isCompliant; + return this; + } + + /** + * Get subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set subscription ID. + * + * @param subscriptionId the subscriptionId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set resource type. + * + * @param resourceType the resourceType value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get resource location. + * + * @return the resourceLocation value + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set resource location. + * + * @param resourceLocation the resourceLocation value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get resource group name. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set resource group name. + * + * @param resourceGroup the resourceGroup value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get list of resource tags. + * + * @return the resourceTags value + */ + public String resourceTags() { + return this.resourceTags; + } + + /** + * Set list of resource tags. + * + * @param resourceTags the resourceTags value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceTags(String resourceTags) { + this.resourceTags = resourceTags; + return this; + } + + /** + * Get policy assignment name. + * + * @return the policyAssignmentName value + */ + public String policyAssignmentName() { + return this.policyAssignmentName; + } + + /** + * Set policy assignment name. + * + * @param policyAssignmentName the policyAssignmentName value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentName(String policyAssignmentName) { + this.policyAssignmentName = policyAssignmentName; + return this; + } + + /** + * Get policy assignment owner. + * + * @return the policyAssignmentOwner value + */ + public String policyAssignmentOwner() { + return this.policyAssignmentOwner; + } + + /** + * Set policy assignment owner. + * + * @param policyAssignmentOwner the policyAssignmentOwner value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentOwner(String policyAssignmentOwner) { + this.policyAssignmentOwner = policyAssignmentOwner; + return this; + } + + /** + * Get policy assignment parameters. + * + * @return the policyAssignmentParameters value + */ + public String policyAssignmentParameters() { + return this.policyAssignmentParameters; + } + + /** + * Set policy assignment parameters. + * + * @param policyAssignmentParameters the policyAssignmentParameters value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentParameters(String policyAssignmentParameters) { + this.policyAssignmentParameters = policyAssignmentParameters; + return this; + } + + /** + * Get policy assignment scope. + * + * @return the policyAssignmentScope value + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Set policy assignment scope. + * + * @param policyAssignmentScope the policyAssignmentScope value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentScope(String policyAssignmentScope) { + this.policyAssignmentScope = policyAssignmentScope; + return this; + } + + /** + * Get policy definition name. + * + * @return the policyDefinitionName value + */ + public String policyDefinitionName() { + return this.policyDefinitionName; + } + + /** + * Set policy definition name. + * + * @param policyDefinitionName the policyDefinitionName value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionName(String policyDefinitionName) { + this.policyDefinitionName = policyDefinitionName; + 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 PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionAction(String policyDefinitionAction) { + this.policyDefinitionAction = policyDefinitionAction; + return this; + } + + /** + * Get policy definition category. + * + * @return the policyDefinitionCategory value + */ + public String policyDefinitionCategory() { + return this.policyDefinitionCategory; + } + + /** + * Set policy definition category. + * + * @param policyDefinitionCategory the policyDefinitionCategory value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionCategory(String policyDefinitionCategory) { + this.policyDefinitionCategory = policyDefinitionCategory; + return this; + } + + /** + * Get policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get policy set definition name, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionName value + */ + public String policySetDefinitionName() { + return this.policySetDefinitionName; + } + + /** + * Set policy set definition name, if the policy assignment is for a policy set. + * + * @param policySetDefinitionName the policySetDefinitionName value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionName(String policySetDefinitionName) { + this.policySetDefinitionName = policySetDefinitionName; + return this; + } + + /** + * Get policy set definition owner, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionOwner value + */ + public String policySetDefinitionOwner() { + return this.policySetDefinitionOwner; + } + + /** + * Set policy set definition owner, if the policy assignment is for a policy set. + * + * @param policySetDefinitionOwner the policySetDefinitionOwner value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionOwner(String policySetDefinitionOwner) { + this.policySetDefinitionOwner = policySetDefinitionOwner; + return this; + } + + /** + * Get policy set definition category, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionCategory value + */ + public String policySetDefinitionCategory() { + return this.policySetDefinitionCategory; + } + + /** + * Set policy set definition category, if the policy assignment is for a policy set. + * + * @param policySetDefinitionCategory the policySetDefinitionCategory value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionCategory(String policySetDefinitionCategory) { + this.policySetDefinitionCategory = policySetDefinitionCategory; + return this; + } + + /** + * Get policy set definition parameters, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionParameters value + */ + public String policySetDefinitionParameters() { + return this.policySetDefinitionParameters; + } + + /** + * Set policy set definition parameters, if the policy assignment is for a policy set. + * + * @param policySetDefinitionParameters the policySetDefinitionParameters value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionParameters(String policySetDefinitionParameters) { + this.policySetDefinitionParameters = policySetDefinitionParameters; + return this; + } + + /** + * Get comma seperated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + * + * @return the managementGroupIds value + */ + public String managementGroupIds() { + return this.managementGroupIds; + } + + /** + * Set comma seperated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + * + * @param managementGroupIds the managementGroupIds value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withManagementGroupIds(String managementGroupIds) { + this.managementGroupIds = managementGroupIds; + return this; + } + + /** + * Get reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStatesInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStatesInner.java new file mode 100644 index 000000000000..bafd7d68b29e --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStatesInner.java @@ -0,0 +1,3311 @@ +/** + * 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.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.policyinsights.PolicyStatesResource; +import com.microsoft.azure.management.policyinsights.QueryFailureException; +import com.microsoft.azure.management.policyinsights.QueryOptions; +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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyStates. + */ +public class PolicyStatesInner { + /** The Retrofit service to perform REST calls. */ + private PolicyStatesService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyStatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyStatesInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(PolicyStatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyStates to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyStatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.PolicyStates summarizeForManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForManagementGroup(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @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.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.PolicyStates summarizeForSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForSubscription(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @Path("subscriptionId") String subscriptionId, @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.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.PolicyStates summarizeForResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForResourceGroup(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @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.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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.PolicyStates summarizeForPolicySetDefinition" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForPolicySetDefinition(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @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("$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.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.PolicyStates summarizeForPolicyDefinition" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForPolicyDefinition(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @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("$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.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.PolicyStates summarizeForSubscriptionLevelPolicyAssignment" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForSubscriptionLevelPolicyAssignment(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @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("$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.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.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.PolicyStates getMetadata" }) + @GET("{scope}/providers/Microsoft.PolicyInsights/policyStates/$metadata") + Observable> getMetadata(@Path(value = "scope", encoded = true) String scope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 + * @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 listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).toBlocking().single().body(); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param managementGroupName Management group name. + * @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 listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName), 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (managementGroupName == null) { + throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, 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 = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param managementGroupName Management group name. + * @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 listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions), 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (managementGroupName == null) { + throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, 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 = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForManagementGroupDelegate(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); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management 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 summarizeForManagementGroup(String managementGroupName) { + return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management 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 summarizeForManagementGroupAsync(String managementGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForManagementGroupWithServiceResponseAsync(managementGroupName), serviceCallback); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SummarizeResultsInner object + */ + public Observable summarizeForManagementGroupAsync(String managementGroupName) { + return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SummarizeResultsInner object + */ + public Observable> summarizeForManagementGroupWithServiceResponseAsync(String managementGroupName) { + if (managementGroupName == null) { + throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group 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 summarizeForManagementGroup(String managementGroupName, QueryOptions queryOptions) { + return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group 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 summarizeForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @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 SummarizeResultsInner object + */ + public Observable summarizeForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions) { + return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForManagementGroupWithServiceResponseAsync(String managementGroupName, QueryOptions queryOptions) { + if (managementGroupName == null) { + throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-04-04"; + 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.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForManagementGroupDelegate(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 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 + * @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 listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId).toBlocking().single().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. + * @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 listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId), serviceCallback); + } + + /** + * 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForSubscription(policyStatesResource, subscriptionId, 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 = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions).toBlocking().single().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. + * @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 listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions), serviceCallback); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, 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."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForSubscription(policyStatesResource, subscriptionId, 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 = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForSubscriptionDelegate(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); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscription(String subscriptionId) { + return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 summarizeForSubscriptionAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForSubscriptionAsync(String subscriptionId) { + return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForSubscriptionWithServiceResponseAsync(String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscription(String subscriptionId, QueryOptions queryOptions) { + return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 summarizeForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @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 SummarizeResultsInner object + */ + public Observable summarizeForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) { + return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForSubscriptionWithServiceResponseAsync(String subscriptionId, QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-04-04"; + 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.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForSubscriptionDelegate(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 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 + * @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 listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName).toBlocking().single().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. + * @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 listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName), serviceCallback); + } + + /** + * 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + 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."); + } + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, 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 = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).toBlocking().single().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. + * @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 listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions), serviceCallback); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, 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."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, 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 = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceGroupDelegate(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); + } + + /** + * Summarizes policy states 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 + * @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 summarizeForResourceGroup(String subscriptionId, String resourceGroupName) { + return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName) { + return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForResourceGroupWithServiceResponseAsync(String subscriptionId, 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 policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 summarizeForResourceGroup(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 SummarizeResultsInner object + */ + public Observable summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, 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 policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-04-04"; + 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.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForResourceGroupDelegate(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. + * + * @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 + * @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 listQueryResultsForResource(PolicyStatesResource policyStatesResource, String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId).toBlocking().single().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. + * @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 listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId), serviceCallback); + } + + /** + * 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResource(policyStatesResource, resourceId, 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 = listQueryResultsForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForResource(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { + return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions).toBlocking().single().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. + * @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 listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions), serviceCallback); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResource(policyStatesResource, resourceId, 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 = listQueryResultsForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceDelegate(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); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @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 summarizeForResource(String resourceId) { + return summarizeForResourceWithServiceResponseAsync(resourceId).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the 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 summarizeForResourceAsync(String resourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceWithServiceResponseAsync(resourceId), serviceCallback); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SummarizeResultsInner object + */ + public Observable summarizeForResourceAsync(String resourceId) { + return summarizeForResourceWithServiceResponseAsync(resourceId).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SummarizeResultsInner object + */ + public Observable> summarizeForResourceWithServiceResponseAsync(String resourceId) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForResource(policyStatesSummaryResource, resourceId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @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 summarizeForResource(String resourceId, QueryOptions queryOptions) { + return summarizeForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the 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 summarizeForResourceAsync(String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceWithServiceResponseAsync(resourceId, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the 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 SummarizeResultsInner object + */ + public Observable summarizeForResourceAsync(String resourceId, QueryOptions queryOptions) { + return summarizeForResourceWithServiceResponseAsync(resourceId, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the 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 SummarizeResultsInner object + */ + public Observable> summarizeForResourceWithServiceResponseAsync(String resourceId, QueryOptions queryOptions) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-04-04"; + 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.summarizeForResource(policyStatesSummaryResource, resourceId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForResourceDelegate(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 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 + * @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(); + } + + /** + * 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. + * @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); + } + + /** + * 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 + */ + public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName).map(new Func1, PolicyStatesQueryResultsInner>() { + @Override + public PolicyStatesQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + */ + public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, 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 (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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); + } + } + }); + } + + /** + * 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. + * @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(); + } + + /** + * 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. + * @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); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { + @Override + public PolicyStatesQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + 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."); + } + 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 = "2018-04-04"; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForPolicySetDefinitionDelegate(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); + } + + /** + * Summarizes policy states 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 + * @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(); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @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 summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { + return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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); + } + } + }); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @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 SummarizeResultsInner object if successful. + */ + public SummarizeResultsInner summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @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 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 set definition. + * + * @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 SummarizeResultsInner object + */ + 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(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForPolicySetDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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) + .build(response); + } + + /** + * 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 + * @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 listQueryResultsForPolicyDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName).toBlocking().single().body(); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @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); + } + + /** + * 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 + */ + 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(); + } + }); + } + + /** + * 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 + */ + public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, 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 (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, 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 = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForPolicyDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @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); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, 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."); + } + Validator.validate(queryOptions); + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, 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 = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForPolicyDefinitionDelegate(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); + } + + /** + * Summarizes policy states 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 + * @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(); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { + return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 SummarizeResultsInner object if successful. + */ + public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 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 definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 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(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName, 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."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.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 = summarizeForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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) + .build(response); + } + + /** + * 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 + * @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 listQueryResultsForSubscriptionLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @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); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, 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 (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForSubscriptionLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @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); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, 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."); + } + Validator.validate(queryOptions); + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(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); + } + + /** + * Summarizes policy states 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 + * @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(); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { + return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 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(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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> summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName, 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."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.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 = summarizeForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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 PolicyStatesQueryResultsInner object if successful. + */ + public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName).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(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName), 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner 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."); + } + 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 = "2018-04-04"; + 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.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } 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 PolicyStatesQueryResultsInner 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(); + } + + /** + * 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(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, 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 = "2018-04-04"; + 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.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(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); + } + + /** + * 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 = "2018-04-04"; + 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 = "2018-04-04"; + 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); + } + + /** + * 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 + * @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. + */ + public String getMetadata(String scope) { + return getMetadataWithServiceResponseAsync(scope).toBlocking().single().body(); + } + + /** + * 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. + * @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); + } + + /** + * 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 to the String object + */ + public Observable getMetadataAsync(String scope) { + return getMetadataWithServiceResponseAsync(scope).map(new Func1, String>() { + @Override + public String call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 to the String object + */ + public Observable> getMetadataWithServiceResponseAsync(String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + final String apiVersion = "2018-04-04"; + return service.getMetadata(scope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMetadataDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMetadataDelegate(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); + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStatesQueryResultsInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStatesQueryResultsInner.java new file mode 100644 index 000000000000..bc04a7751401 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyStatesQueryResultsInner.java @@ -0,0 +1,98 @@ +/** + * 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.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Query results. + */ +public class PolicyStatesQueryResultsInner { + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * OData entity count; represents the number of policy state records + * returned. + */ + @JsonProperty(value = "@odata\\.count") + private Integer odatacount; + + /** + * Query results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the PolicyStatesQueryResultsInner object itself. + */ + public PolicyStatesQueryResultsInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get oData entity count; represents the number of policy state records returned. + * + * @return the odatacount value + */ + public Integer odatacount() { + return this.odatacount; + } + + /** + * Set oData entity count; represents the number of policy state records returned. + * + * @param odatacount the odatacount value to set + * @return the PolicyStatesQueryResultsInner object itself. + */ + public PolicyStatesQueryResultsInner withOdatacount(Integer odatacount) { + this.odatacount = odatacount; + return this; + } + + /** + * Get query results. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set query results. + * + * @param value the value value to set + * @return the PolicyStatesQueryResultsInner object itself. + */ + public PolicyStatesQueryResultsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyTrackedResourceInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyTrackedResourceInner.java new file mode 100644 index 000000000000..6cb4bd41d13a --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyTrackedResourceInner.java @@ -0,0 +1,97 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.policyinsights.PolicyDetails; +import com.microsoft.azure.management.policyinsights.TrackedResourceModificationDetails; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy tracked resource record. + */ +public class PolicyTrackedResourceInner { + /** + * The ID of the policy tracked resource. + */ + @JsonProperty(value = "trackedResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String trackedResourceId; + + /** + * The details of the policy that require the tracked resource. + */ + @JsonProperty(value = "policyDetails", access = JsonProperty.Access.WRITE_ONLY) + private PolicyDetails policyDetails; + + /** + * The details of the policy triggered deployment that created the tracked + * resource. + */ + @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY) + private TrackedResourceModificationDetails createdBy; + + /** + * The details of the policy triggered deployment that modified the tracked + * resource. + */ + @JsonProperty(value = "lastModifiedBy", access = JsonProperty.Access.WRITE_ONLY) + private TrackedResourceModificationDetails lastModifiedBy; + + /** + * Timestamp of the last update to the tracked resource. + */ + @JsonProperty(value = "lastUpdateUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdateUtc; + + /** + * Get the ID of the policy tracked resource. + * + * @return the trackedResourceId value + */ + public String trackedResourceId() { + return this.trackedResourceId; + } + + /** + * Get the details of the policy that require the tracked resource. + * + * @return the policyDetails value + */ + public PolicyDetails policyDetails() { + return this.policyDetails; + } + + /** + * Get the details of the policy triggered deployment that created the tracked resource. + * + * @return the createdBy value + */ + public TrackedResourceModificationDetails createdBy() { + return this.createdBy; + } + + /** + * Get the details of the policy triggered deployment that modified the tracked resource. + * + * @return the lastModifiedBy value + */ + public TrackedResourceModificationDetails lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get timestamp of the last update to the tracked resource. + * + * @return the lastUpdateUtc value + */ + public DateTime lastUpdateUtc() { + return this.lastUpdateUtc; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyTrackedResourcesInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyTrackedResourcesInner.java new file mode 100644 index 000000000000..1448d61794e0 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/PolicyTrackedResourcesInner.java @@ -0,0 +1,1486 @@ +/** + * 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.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.QueryFailureException; +import com.microsoft.azure.management.policyinsights.QueryOptions; +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 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; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyTrackedResources. + */ +public class PolicyTrackedResourcesInner { + /** The Retrofit service to perform REST calls. */ + private PolicyTrackedResourcesService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyTrackedResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyTrackedResourcesInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(PolicyTrackedResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyTrackedResources to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyTrackedResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.PolicyTrackedResources listQueryResultsForManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + Observable> listQueryResultsForManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @Path("policyTrackedResourcesResource") String policyTrackedResourcesResource, @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.PolicyTrackedResources listQueryResultsForSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + Observable> listQueryResultsForSubscription(@Path("policyTrackedResourcesResource") String policyTrackedResourcesResource, @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.PolicyTrackedResources listQueryResultsForResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + Observable> listQueryResultsForResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("policyTrackedResourcesResource") String policyTrackedResourcesResource, @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.PolicyTrackedResources listQueryResultsForResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + Observable> listQueryResultsForResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("policyTrackedResourcesResource") String policyTrackedResourcesResource, @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.PolicyTrackedResources 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.PolicyTrackedResources 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.PolicyTrackedResources 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.PolicyTrackedResources listQueryResultsForResourceNext" }) + @GET + Observable> listQueryResultsForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management 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 PagedList<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management 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> listQueryResultsForManagementGroupAsync(final String managementGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupSinglePageAsync(managementGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForManagementGroupAsync(final String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable>> listQueryResultsForManagementGroupWithServiceResponseAsync(final String managementGroupName) { + return listQueryResultsForManagementGroupSinglePageAsync(managementGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyTrackedResourceInner> 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 managementGroupsNamespace = "Microsoft.Management"; + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group 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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group 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> 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); + } + + /** + * Queries policy tracked resources under the management group. + * + * @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 PagedList<PolicyTrackedResourceInner> object + */ + 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(); + } + }); + } + + /** + * Queries policy tracked resources under the management group. + * + * @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 PagedList<PolicyTrackedResourceInner> object + */ + public Observable>> 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 tracked 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<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + 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 managementGroupsNamespace = "Microsoft.Management"; + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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> listQueryResultsForSubscriptionAsync(final String subscriptionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionSinglePageAsync(subscriptionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForSubscriptionAsync(final String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> 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)); + } + }); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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> 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); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @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 PagedList<PolicyTrackedResourceInner> object + */ + 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(); + } + }); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @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 PagedList<PolicyTrackedResourceInner> object + */ + 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 tracked 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<PolicyTrackedResourceInner> 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 policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroup(final String resourceGroupName, final String subscriptionId) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, subscriptionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription 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> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, subscriptionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(resourceGroupName, subscriptionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable>> listQueryResultsForResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String subscriptionId) { + return listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, 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(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final String resourceGroupName, final String subscriptionId) { + 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."); + } + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroup(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, subscriptionId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription 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> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, subscriptionId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @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 PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(resourceGroupName, subscriptionId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @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 PagedList<PolicyTrackedResourceInner> object + */ + public Observable>> listQueryResultsForResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, 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(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + ServiceResponse> * @param resourceGroupName Resource group name. + 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<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions) { + 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."); + } + Validator.validate(queryOptions); + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the 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> listQueryResultsForResourceAsync(final String resourceId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceSinglePageAsync(resourceId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForResourceAsync(final String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> 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)); + } + }); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceSinglePageAsync(final String resourceId) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the 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> 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); + } + + /** + * Queries policy tracked resources under the 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<PolicyTrackedResourceInner> object + */ + 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(); + } + }); + } + + /** + * Queries policy tracked resources under the 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<PolicyTrackedResourceInner> object + */ + public Observable>> listQueryResultsForResourceWithServiceResponseAsync(final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceSinglePageAsync(resourceId, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy tracked resources under 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<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceSinglePageAsync(final String resourceId, final QueryOptions queryOptions) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy tracked 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<PolicyTrackedResourceInner> 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 tracked 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked resources under 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<PolicyTrackedResourceInner> 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 tracked resources under 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 tracked resources under 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<PolicyTrackedResourceInner> 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 tracked resources under 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<PolicyTrackedResourceInner> 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 tracked resources under 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<PolicyTrackedResourceInner> 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); + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationDeploymentInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationDeploymentInner.java new file mode 100644 index 000000000000..284bdeacdaaf --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationDeploymentInner.java @@ -0,0 +1,124 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.policyinsights.ErrorDefinition; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of a single deployment created by the remediation. + */ +public class RemediationDeploymentInner { + /** + * Resource ID of the resource that is being remediated by the deployment. + */ + @JsonProperty(value = "remediatedResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String remediatedResourceId; + + /** + * Resource ID of the template deployment that will remediate the resource. + */ + @JsonProperty(value = "deploymentId", access = JsonProperty.Access.WRITE_ONLY) + private String deploymentId; + + /** + * Status of the remediation deployment. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Location of the resource that is being remediated. + */ + @JsonProperty(value = "resourceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String resourceLocation; + + /** + * Error encountered while remediated the resource. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ErrorDefinition error; + + /** + * The time at which the remediation was created. + */ + @JsonProperty(value = "createdOn", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdOn; + + /** + * The time at which the remediation deployment was last updated. + */ + @JsonProperty(value = "lastUpdatedOn", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedOn; + + /** + * Get resource ID of the resource that is being remediated by the deployment. + * + * @return the remediatedResourceId value + */ + public String remediatedResourceId() { + return this.remediatedResourceId; + } + + /** + * Get resource ID of the template deployment that will remediate the resource. + * + * @return the deploymentId value + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Get status of the remediation deployment. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get location of the resource that is being remediated. + * + * @return the resourceLocation value + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Get error encountered while remediated the resource. + * + * @return the error value + */ + public ErrorDefinition error() { + return this.error; + } + + /** + * Get the time at which the remediation was created. + * + * @return the createdOn value + */ + public DateTime createdOn() { + return this.createdOn; + } + + /** + * Get the time at which the remediation deployment was last updated. + * + * @return the lastUpdatedOn value + */ + public DateTime lastUpdatedOn() { + return this.lastUpdatedOn; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationInner.java new file mode 100644 index 000000000000..df5570e636fa --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationInner.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.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.policyinsights.RemediationFilters; +import com.microsoft.azure.management.policyinsights.RemediationDeploymentSummary; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The remediation definition. + */ +@JsonFlatten +public class RemediationInner extends ProxyResource { + /** + * The resource ID of the policy assignment that should be remediated. + */ + @JsonProperty(value = "properties.policyAssignmentId") + private String policyAssignmentId; + + /** + * The policy definition reference ID of the individual definition that + * should be remediated. Required when the policy assignment being + * remediated assigns a policy set definition. + */ + @JsonProperty(value = "properties.policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * The status of the remediation. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The time at which the remediation was created. + */ + @JsonProperty(value = "properties.createdOn", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdOn; + + /** + * The time at which the remediation was last updated. + */ + @JsonProperty(value = "properties.lastUpdatedOn", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedOn; + + /** + * The filters that will be applied to determine which resources to + * remediate. + */ + @JsonProperty(value = "properties.filters") + private RemediationFilters filters; + + /** + * The deployment status summary for all deplyoments created by the + * remediation. + */ + @JsonProperty(value = "properties.deploymentStatus") + private RemediationDeploymentSummary deploymentStatus; + + /** + * Get the resource ID of the policy assignment that should be remediated. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set the resource ID of the policy assignment that should be remediated. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the RemediationInner object itself. + */ + public RemediationInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get the policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set the policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the RemediationInner object itself. + */ + public RemediationInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the status of the remediation. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the time at which the remediation was created. + * + * @return the createdOn value + */ + public DateTime createdOn() { + return this.createdOn; + } + + /** + * Get the time at which the remediation was last updated. + * + * @return the lastUpdatedOn value + */ + public DateTime lastUpdatedOn() { + return this.lastUpdatedOn; + } + + /** + * Get the filters that will be applied to determine which resources to remediate. + * + * @return the filters value + */ + public RemediationFilters filters() { + return this.filters; + } + + /** + * Set the filters that will be applied to determine which resources to remediate. + * + * @param filters the filters value to set + * @return the RemediationInner object itself. + */ + public RemediationInner withFilters(RemediationFilters filters) { + this.filters = filters; + return this; + } + + /** + * Get the deployment status summary for all deplyoments created by the remediation. + * + * @return the deploymentStatus value + */ + public RemediationDeploymentSummary deploymentStatus() { + return this.deploymentStatus; + } + + /** + * Set the deployment status summary for all deplyoments created by the remediation. + * + * @param deploymentStatus the deploymentStatus value to set + * @return the RemediationInner object itself. + */ + public RemediationInner withDeploymentStatus(RemediationDeploymentSummary deploymentStatus) { + this.deploymentStatus = deploymentStatus; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationsInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationsInner.java new file mode 100644 index 000000000000..f73afbe698c5 --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/RemediationsInner.java @@ -0,0 +1,4372 @@ +/** + * 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.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.ErrorResponseException; +import com.microsoft.azure.management.policyinsights.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.POST; +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 Remediations. + */ +public class RemediationsInner { + /** The Retrofit service to perform REST calls. */ + private RemediationsService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of RemediationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RemediationsInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(RemediationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Remediations to be + * used by Retrofit to perform actually REST calls. + */ + interface RemediationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.Remediations listDeploymentsAtManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + Observable> listDeploymentsAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.Remediations cancelAtManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + Observable> cancelAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @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.Remediations listForManagementGroup" }) + @GET("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations") + Observable> listForManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @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.Remediations createOrUpdateAtManagementGroup" }) + @PUT("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> createOrUpdateAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Body RemediationInner 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.Remediations getAtManagementGroup" }) + @GET("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> getAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @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.Remediations deleteAtManagementGroup" }) + @HTTP(path = "providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @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.Remediations listDeploymentsAtSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + Observable> listDeploymentsAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.Remediations cancelAtSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + Observable> cancelAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @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.Remediations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations") + 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.Remediations createOrUpdateAtSubscription" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> createOrUpdateAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Body RemediationInner 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.Remediations getAtSubscription" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> getAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @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.Remediations deleteAtSubscription" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", method = "DELETE", hasBody = true) + Observable> deleteAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @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.Remediations listDeploymentsAtResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + Observable> listDeploymentsAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.Remediations cancelAtResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + Observable> cancelAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @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.Remediations listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations") + 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.Remediations createOrUpdateAtResourceGroup" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> createOrUpdateAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Body RemediationInner 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.Remediations getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @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.Remediations deleteAtResourceGroup" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", method = "DELETE", hasBody = true) + Observable> deleteAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @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.Remediations listDeploymentsAtResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + Observable> listDeploymentsAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.Remediations cancelAtResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + Observable> cancelAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @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.Remediations listForResource" }) + @GET("{resourceId}/providers/Microsoft.PolicyInsights/remediations") + 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.Remediations createOrUpdateAtResource" }) + @PUT("{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> createOrUpdateAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Body RemediationInner 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.Remediations getAtResource" }) + @GET("{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> getAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @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.Remediations deleteAtResource" }) + @HTTP(path = "{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", method = "DELETE", hasBody = true) + Observable> deleteAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @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.Remediations listDeploymentsAtManagementGroupNext" }) + @GET + Observable> listDeploymentsAtManagementGroupNext(@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.Remediations listForManagementGroupNext" }) + @GET + Observable> listForManagementGroupNext(@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.Remediations listDeploymentsAtSubscriptionNext" }) + @GET + Observable> listDeploymentsAtSubscriptionNext(@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.Remediations 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.Remediations listDeploymentsAtResourceGroupNext" }) + @GET + Observable> listDeploymentsAtResourceGroupNext(@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.Remediations 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.Remediations listDeploymentsAtResourceNext" }) + @GET + Observable> listDeploymentsAtResourceNext(@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.Remediations listForResourceNext" }) + @GET + Observable> listForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtManagementGroup(final String managementGroupId, final String remediationName) { + ServiceResponse> response = listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName) { + return listDeploymentsAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtManagementGroupWithServiceResponseAsync(final String managementGroupId, final String remediationName) { + return listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName) + .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(listDeploymentsAtManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtManagementGroupSinglePageAsync(final String managementGroupId, final String remediationName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtManagementGroup(final String managementGroupId, final String remediationName, final QueryOptions queryOptions) { + ServiceResponse> response = listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtManagementGroupWithServiceResponseAsync(final String managementGroupId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, 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(listDeploymentsAtManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + ServiceResponse> * @param managementGroupId Management group ID. + ServiceResponse> * @param remediationName The name of the remediation. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtManagementGroupSinglePageAsync(final String managementGroupId, final String remediationName, final QueryOptions queryOptions) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtManagementGroupDelegate(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); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner cancelAtManagementGroup(String managementGroupId, String remediationName) { + return cancelAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).toBlocking().single().body(); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 cancelAtManagementGroupAsync(String managementGroupId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName), serviceCallback); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable cancelAtManagementGroupAsync(String managementGroupId, String remediationName) { + return cancelAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> cancelAtManagementGroupWithServiceResponseAsync(String managementGroupId, String remediationName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + return service.cancelAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtManagementGroupDelegate(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); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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<RemediationInner> object if successful. + */ + public PagedList listForManagementGroup(final String managementGroupId) { + ServiceResponse> response = listForManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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> listForManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> object + */ + public Observable> listForManagementGroupAsync(final String managementGroupId) { + return listForManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> object + */ + public Observable>> listForManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listForManagementGroupSinglePageAsync(managementGroupId) + .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(listForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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<RemediationInner> object if successful. + */ + public PagedList listForManagementGroup(final String managementGroupId, final QueryOptions queryOptions) { + ServiceResponse> response = listForManagementGroupSinglePageAsync(managementGroupId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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> listForManagementGroupAsync(final String managementGroupId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForManagementGroupSinglePageAsync(managementGroupId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> object + */ + public Observable> listForManagementGroupAsync(final String managementGroupId, final QueryOptions queryOptions) { + return listForManagementGroupWithServiceResponseAsync(managementGroupId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> object + */ + public Observable>> listForManagementGroupWithServiceResponseAsync(final String managementGroupId, final QueryOptions queryOptions) { + return listForManagementGroupSinglePageAsync(managementGroupId, 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(listForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all remediations for the management group. + * + ServiceResponse> * @param managementGroupId Management group ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForManagementGroupSinglePageAsync(final String managementGroupId, final QueryOptions queryOptions) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForManagementGroupDelegate(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 a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 RemediationInner object if successful. + */ + public RemediationInner createOrUpdateAtManagementGroup(String managementGroupId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 createOrUpdateAtManagementGroupAsync(String managementGroupId, String remediationName, RemediationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName, parameters), serviceCallback); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable createOrUpdateAtManagementGroupAsync(String managementGroupId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName, parameters).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String managementGroupId, String remediationName, RemediationInner parameters) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + return service.createOrUpdateAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtManagementGroupDelegate(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 remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner getAtManagementGroup(String managementGroupId, String remediationName) { + return getAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).toBlocking().single().body(); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 getAtManagementGroupAsync(String managementGroupId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName), serviceCallback); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable getAtManagementGroupAsync(String managementGroupId, String remediationName) { + return getAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> getAtManagementGroupWithServiceResponseAsync(String managementGroupId, String remediationName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + return service.getAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupDelegate(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 remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner deleteAtManagementGroup(String managementGroupId, String remediationName) { + return deleteAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).toBlocking().single().body(); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 deleteAtManagementGroupAsync(String managementGroupId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName), serviceCallback); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable deleteAtManagementGroupAsync(String managementGroupId, String remediationName) { + return deleteAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> deleteAtManagementGroupWithServiceResponseAsync(String managementGroupId, String remediationName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + return service.deleteAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtManagementGroupDelegate(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 deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtSubscription(final String subscriptionId, final String remediationName) { + ServiceResponse> response = listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName) { + return listDeploymentsAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtSubscriptionWithServiceResponseAsync(final String subscriptionId, final String remediationName) { + return listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName) + .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(listDeploymentsAtSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtSubscriptionSinglePageAsync(final String subscriptionId, final String remediationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + return service.listDeploymentsAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtSubscription(final String subscriptionId, final String remediationName, final QueryOptions queryOptions) { + ServiceResponse> response = listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtSubscriptionWithServiceResponseAsync(final String subscriptionId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName, 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(listDeploymentsAtSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param remediationName The name of the remediation. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtSubscriptionSinglePageAsync(final String subscriptionId, final String remediationName, final QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + return service.listDeploymentsAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtSubscriptionDelegate(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); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner cancelAtSubscription(String subscriptionId, String remediationName) { + return cancelAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).toBlocking().single().body(); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 cancelAtSubscriptionAsync(String subscriptionId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName), serviceCallback); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable cancelAtSubscriptionAsync(String subscriptionId, String remediationName) { + return cancelAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> cancelAtSubscriptionWithServiceResponseAsync(String subscriptionId, String remediationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.cancelAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtSubscriptionDelegate(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); + } + + /** + * Gets all remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> 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 = "2018-07-01-preview"; + 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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> 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 remediations for the subscription. + * + * @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 PagedList<RemediationInner> 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 remediations for the subscription. + * + * @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 PagedList<RemediationInner> 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 remediations for 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<RemediationInner> 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 = "2018-07-01-preview"; + 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 a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 RemediationInner object if successful. + */ + public RemediationInner createOrUpdateAtSubscription(String subscriptionId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 remediationName, RemediationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName, parameters), serviceCallback); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable createOrUpdateAtSubscriptionAsync(String subscriptionId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName, parameters).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> createOrUpdateAtSubscriptionWithServiceResponseAsync(String subscriptionId, String remediationName, RemediationInner parameters) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-07-01-preview"; + return service.createOrUpdateAtSubscription(subscriptionId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtSubscriptionDelegate(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 remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner getAtSubscription(String subscriptionId, String remediationName) { + return getAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).toBlocking().single().body(); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName), serviceCallback); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable getAtSubscriptionAsync(String subscriptionId, String remediationName) { + return getAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> getAtSubscriptionWithServiceResponseAsync(String subscriptionId, String remediationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.getAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner deleteAtSubscription(String subscriptionId, String remediationName) { + return deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).toBlocking().single().body(); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName), serviceCallback); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable deleteAtSubscriptionAsync(String subscriptionId, String remediationName) { + return deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> deleteAtSubscriptionWithServiceResponseAsync(String subscriptionId, String remediationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.deleteAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResourceGroup(final String subscriptionId, final String resourceGroupName, final String remediationName) { + ServiceResponse> response = listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName) { + return listDeploymentsAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String remediationName) { + return listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName) + .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(listDeploymentsAtResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceGroupSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String remediationName) { + 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResourceGroup(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions) { + ServiceResponse> response = listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName, 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(listDeploymentsAtResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param remediationName The name of the remediation. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceGroupSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtResourceGroupDelegate(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); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner cancelAtResourceGroup(String subscriptionId, String resourceGroupName, String remediationName) { + return cancelAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).toBlocking().single().body(); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 cancelAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName), serviceCallback); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable cancelAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + return cancelAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> cancelAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String remediationName) { + 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.cancelAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtResourceGroupDelegate(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); + } + + /** + * Gets all remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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> 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 remediations for the subscription. + * + * @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<RemediationInner> 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 remediations for the subscription. + * + * @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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> 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 = "2018-07-01-preview"; + 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PagedList<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PagedList<RemediationInner> 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 remediations for the subscription. + * + 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<RemediationInner> 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 = "2018-07-01-preview"; + 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 a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 RemediationInner object if successful. + */ + public RemediationInner createOrUpdateAtResourceGroup(String subscriptionId, String resourceGroupName, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 remediationName, RemediationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName, parameters), serviceCallback); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable createOrUpdateAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName, parameters).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> createOrUpdateAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String remediationName, RemediationInner 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-07-01-preview"; + return service.createOrUpdateAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtResourceGroupDelegate(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 remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner getByResourceGroup(String subscriptionId, String resourceGroupName, String remediationName) { + return getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).toBlocking().single().body(); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName), serviceCallback); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable getByResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + return getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String remediationName) { + 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.getByResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner deleteAtResourceGroup(String subscriptionId, String resourceGroupName, String remediationName) { + return deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).toBlocking().single().body(); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName), serviceCallback); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable deleteAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + return deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> deleteAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String remediationName) { + 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.deleteAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResource(final String resourceId, final String remediationName) { + ServiceResponse> response = listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtResourceAsync(final String resourceId, final String remediationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceAsync(final String resourceId, final String remediationName) { + return listDeploymentsAtResourceWithServiceResponseAsync(resourceId, remediationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceWithServiceResponseAsync(final String resourceId, final String remediationName) { + return listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName) + .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(listDeploymentsAtResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceSinglePageAsync(final String resourceId, final String remediationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + return service.listDeploymentsAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResource(final String resourceId, final String remediationName, final QueryOptions queryOptions) { + ServiceResponse> response = listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtResourceAsync(final String resourceId, final String remediationName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceAsync(final String resourceId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtResourceWithServiceResponseAsync(resourceId, remediationName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceWithServiceResponseAsync(final String resourceId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, 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(listDeploymentsAtResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + ServiceResponse> * @param resourceId Resource ID. + ServiceResponse> * @param remediationName The name of the remediation. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceSinglePageAsync(final String resourceId, final String remediationName, final QueryOptions queryOptions) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + return service.listDeploymentsAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtResourceDelegate(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); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner cancelAtResource(String resourceId, String remediationName) { + return cancelAtResourceWithServiceResponseAsync(resourceId, remediationName).toBlocking().single().body(); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 cancelAtResourceAsync(String resourceId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtResourceWithServiceResponseAsync(resourceId, remediationName), serviceCallback); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable cancelAtResourceAsync(String resourceId, String remediationName) { + return cancelAtResourceWithServiceResponseAsync(resourceId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> cancelAtResourceWithServiceResponseAsync(String resourceId, String remediationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.cancelAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtResourceDelegate(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); + } + + /** + * Gets all remediations 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<RemediationInner> 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 remediations 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 remediations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> 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 remediations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> 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 remediations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> 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 = "2018-07-01-preview"; + 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 remediations 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<RemediationInner> 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 remediations 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 = "2018-07-01-preview"; + 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 a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 RemediationInner object if successful. + */ + public RemediationInner createOrUpdateAtResource(String resourceId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceWithServiceResponseAsync(resourceId, remediationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 remediationName, RemediationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtResourceWithServiceResponseAsync(resourceId, remediationName, parameters), serviceCallback); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable createOrUpdateAtResourceAsync(String resourceId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceWithServiceResponseAsync(resourceId, remediationName, parameters).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> createOrUpdateAtResourceWithServiceResponseAsync(String resourceId, String remediationName, RemediationInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-07-01-preview"; + return service.createOrUpdateAtResource(resourceId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtResourceDelegate(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 remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner getAtResource(String resourceId, String remediationName) { + return getAtResourceWithServiceResponseAsync(resourceId, remediationName).toBlocking().single().body(); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtResourceWithServiceResponseAsync(resourceId, remediationName), serviceCallback); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable getAtResourceAsync(String resourceId, String remediationName) { + return getAtResourceWithServiceResponseAsync(resourceId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> getAtResourceWithServiceResponseAsync(String resourceId, String remediationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.getAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner deleteAtResource(String resourceId, String remediationName) { + return deleteAtResourceWithServiceResponseAsync(resourceId, remediationName).toBlocking().single().body(); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtResourceWithServiceResponseAsync(resourceId, remediationName), serviceCallback); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable deleteAtResourceAsync(String resourceId, String remediationName) { + return deleteAtResourceWithServiceResponseAsync(resourceId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> deleteAtResourceWithServiceResponseAsync(String resourceId, String remediationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.deleteAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 deployments for a remediation at management group scope. + * + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @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> listDeploymentsAtManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtManagementGroupNextAsync(final String nextPageLink) { + return listDeploymentsAtManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(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(listDeploymentsAtManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtManagementGroupNextSinglePageAsync(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.listDeploymentsAtManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtManagementGroupNextDelegate(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 remediations for the management 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<RemediationInner> object if successful. + */ + public PagedList listForManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all remediations for 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> listForManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all remediations for 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<RemediationInner> object + */ + public Observable> listForManagementGroupNextAsync(final String nextPageLink) { + return listForManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all remediations for 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<RemediationInner> object + */ + public Observable>> listForManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(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(listForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all remediations for 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<RemediationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForManagementGroupNextSinglePageAsync(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.listForManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForManagementGroupNextDelegate(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 deployments for a remediation at subscription scope. + * + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtSubscriptionNext(final String nextPageLink) { + ServiceResponse> response = listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @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> listDeploymentsAtSubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtSubscriptionNextAsync(final String nextPageLink) { + return listDeploymentsAtSubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtSubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(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(listDeploymentsAtSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtSubscriptionNextSinglePageAsync(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.listDeploymentsAtSubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtSubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtSubscriptionNextDelegate(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 remediations 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<RemediationInner> 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 remediations 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 deployments for a remediation at resource group scope. + * + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @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> listDeploymentsAtResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceGroupNextAsync(final String nextPageLink) { + return listDeploymentsAtResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(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(listDeploymentsAtResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceGroupNextSinglePageAsync(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.listDeploymentsAtResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtResourceGroupNextDelegate(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 remediations 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<RemediationInner> 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 remediations 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> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 deployments for a remediation at resource scope. + * + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResourceNext(final String nextPageLink) { + ServiceResponse> response = listDeploymentsAtResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @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> listDeploymentsAtResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceNextAsync(final String nextPageLink) { + return listDeploymentsAtResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(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(listDeploymentsAtResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceNextSinglePageAsync(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.listDeploymentsAtResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtResourceNextDelegate(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 remediations 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<RemediationInner> 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 remediations 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/SummarizeResultsInner.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/SummarizeResultsInner.java new file mode 100644 index 000000000000..b13ca45d113a --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/SummarizeResultsInner.java @@ -0,0 +1,99 @@ +/** + * 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.implementation; + +import java.util.List; +import com.microsoft.azure.management.policyinsights.Summary; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Summarize action results. + */ +public class SummarizeResultsInner { + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * OData entity count; represents the number of summaries returned; always + * set to 1. + */ + @JsonProperty(value = "@odata\\.count") + private Integer odatacount; + + /** + * Summarize action results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get oData entity count; represents the number of summaries returned; always set to 1. + * + * @return the odatacount value + */ + public Integer odatacount() { + return this.odatacount; + } + + /** + * Set oData entity count; represents the number of summaries returned; always set to 1. + * + * @param odatacount the odatacount value to set + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withOdatacount(Integer odatacount) { + this.odatacount = odatacount; + return this; + } + + /** + * Get summarize action results. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set summarize action results. + * + * @param value the value value to set + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/package-info.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/package-info.java new file mode 100644 index 000000000000..323cd8aaf1fc --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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. + +/** + * This package contains the implementation classes for PolicyInsightsClient. + */ +package com.microsoft.azure.management.policyinsights.implementation; diff --git a/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/package-info.java b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/package-info.java new file mode 100644 index 000000000000..9099deeb2a1c --- /dev/null +++ b/azure-mgmt-policyinsights/src/main/java/com/microsoft/azure/management/policyinsights/package-info.java @@ -0,0 +1,10 @@ +// 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. + +/** + * This package contains the classes for PolicyInsightsClient. + */ +package com.microsoft.azure.management.policyinsights; diff --git a/policyinsights/resource-manager/v2018_04_04/pom.xml b/policyinsights/resource-manager/v2018_04_04/pom.xml index 7b7d6341a767..c3ceabfff206 100644 --- a/policyinsights/resource-manager/v2018_04_04/pom.xml +++ b/policyinsights/resource-manager/v2018_04_04/pom.xml @@ -1,135 +1,133 @@ - - - 4.0.0 - com.microsoft.azure.policyinsights.v2018_04_04 - - com.microsoft.azure - azure-arm-parent - 0.0.3-beta - ../../../pom.xml - - azure-mgmt-policyinsights - 1.0.0-beta-1 - jar - Microsoft Azure SDK for PolicyInsights Management - This package contains Microsoft PolicyInsights Management SDK. - https://github.com/Azure/azure-libraries-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - - - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git - HEAD - - - UTF-8 - - - - - microsoft - Microsoft - - - - - com.microsoft.azure - azure-client-runtime - - - com.microsoft.azure - azure-arm-client-runtime - - - junit - junit - test - - - com.microsoft.azure - azure-client-authentication - test - - - com.microsoft.azure - azure-mgmt-resources - 1.11.1 - test - - - com.microsoft.azure - azure-arm-client-runtime - 1.5.2 - test-jar - test - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - true - true - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - com.microsoft.azure.management.apigeneration.LangDefinitionProcessor - - - true - true - - true - true - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8 - - *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search - - - /** -
* Copyright (c) Microsoft Corporation. All rights reserved. -
* Licensed under the MIT License. See License.txt in the project root for -
* license information. -
*/ - ]]> -
-
-
-
-
-
+ + + 4.0.0 + com.microsoft.azure.policyinsights.v2018_04_04 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-policyinsights + 1.0.0-beta + jar + Microsoft Azure SDK for PolicyInsights Management + This package contains Microsoft PolicyInsights Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/OperationDisplay.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/OperationDisplay.java index 20ecbc62ba34..b1c5a01b83dc 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/OperationDisplay.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/OperationDisplay.java @@ -39,7 +39,7 @@ public class OperationDisplay { private String description; /** - * Get the provider value. + * Get resource provider name. * * @return the provider value */ @@ -48,7 +48,7 @@ public String provider() { } /** - * Set the provider value. + * Set resource provider name. * * @param provider the provider value to set * @return the OperationDisplay object itself. @@ -59,7 +59,7 @@ public OperationDisplay withProvider(String provider) { } /** - * Get the resource value. + * Get resource name on which the operation is performed. * * @return the resource value */ @@ -68,7 +68,7 @@ public String resource() { } /** - * Set the resource value. + * Set resource name on which the operation is performed. * * @param resource the resource value to set * @return the OperationDisplay object itself. @@ -79,7 +79,7 @@ public OperationDisplay withResource(String resource) { } /** - * Get the operation value. + * Get operation name. * * @return the operation value */ @@ -88,7 +88,7 @@ public String operation() { } /** - * Set the operation value. + * Set operation name. * * @param operation the operation value to set * @return the OperationDisplay object itself. @@ -99,7 +99,7 @@ public OperationDisplay withOperation(String operation) { } /** - * Get the description value. + * Get operation description. * * @return the description value */ @@ -108,7 +108,7 @@ public String description() { } /** - * Set the description value. + * Set operation description. * * @param description the description value to set * @return the OperationDisplay object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/PolicyAssignmentSummary.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/PolicyAssignmentSummary.java index 853e2cfeca65..4cf796ef8f23 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/PolicyAssignmentSummary.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/PolicyAssignmentSummary.java @@ -40,7 +40,7 @@ public class PolicyAssignmentSummary { private List policyDefinitions; /** - * Get the policyAssignmentId value. + * Get policy assignment ID. * * @return the policyAssignmentId value */ @@ -49,7 +49,7 @@ public String policyAssignmentId() { } /** - * Set the policyAssignmentId value. + * Set policy assignment ID. * * @param policyAssignmentId the policyAssignmentId value to set * @return the PolicyAssignmentSummary object itself. @@ -60,7 +60,7 @@ public PolicyAssignmentSummary withPolicyAssignmentId(String policyAssignmentId) } /** - * Get the policySetDefinitionId value. + * Get policy set definition ID, if the policy assignment is for a policy set. * * @return the policySetDefinitionId value */ @@ -69,7 +69,7 @@ public String policySetDefinitionId() { } /** - * Set the policySetDefinitionId value. + * Set policy set definition ID, if the policy assignment is for a policy set. * * @param policySetDefinitionId the policySetDefinitionId value to set * @return the PolicyAssignmentSummary object itself. @@ -80,7 +80,7 @@ public PolicyAssignmentSummary withPolicySetDefinitionId(String policySetDefinit } /** - * Get the results value. + * Get non-compliance summary for the policy assignment. * * @return the results value */ @@ -89,7 +89,7 @@ public SummaryResults results() { } /** - * Set the results value. + * Set non-compliance summary for the policy assignment. * * @param results the results value to set * @return the PolicyAssignmentSummary object itself. @@ -100,7 +100,7 @@ public PolicyAssignmentSummary withResults(SummaryResults results) { } /** - * Get the policyDefinitions value. + * Get policy definitions summary. * * @return the policyDefinitions value */ @@ -109,7 +109,7 @@ public List policyDefinitions() { } /** - * Set the policyDefinitions value. + * Set policy definitions summary. * * @param policyDefinitions the policyDefinitions value to set * @return the PolicyAssignmentSummary object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/PolicyDefinitionSummary.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/PolicyDefinitionSummary.java index 20b027ebfac2..74c45dbcef70 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/PolicyDefinitionSummary.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/PolicyDefinitionSummary.java @@ -39,7 +39,7 @@ public class PolicyDefinitionSummary { private SummaryResults results; /** - * Get the policyDefinitionId value. + * Get policy definition ID. * * @return the policyDefinitionId value */ @@ -48,7 +48,7 @@ public String policyDefinitionId() { } /** - * Set the policyDefinitionId value. + * Set policy definition ID. * * @param policyDefinitionId the policyDefinitionId value to set * @return the PolicyDefinitionSummary object itself. @@ -59,7 +59,7 @@ public PolicyDefinitionSummary withPolicyDefinitionId(String policyDefinitionId) } /** - * Get the policyDefinitionReferenceId value. + * Get policy definition reference ID. * * @return the policyDefinitionReferenceId value */ @@ -68,7 +68,7 @@ public String policyDefinitionReferenceId() { } /** - * Set the policyDefinitionReferenceId value. + * Set policy definition reference ID. * * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set * @return the PolicyDefinitionSummary object itself. @@ -79,7 +79,7 @@ public PolicyDefinitionSummary withPolicyDefinitionReferenceId(String policyDefi } /** - * Get the effect value. + * Get policy effect, i.e. policy definition action. * * @return the effect value */ @@ -88,7 +88,7 @@ public String effect() { } /** - * Set the effect value. + * Set policy effect, i.e. policy definition action. * * @param effect the effect value to set * @return the PolicyDefinitionSummary object itself. @@ -99,7 +99,7 @@ public PolicyDefinitionSummary withEffect(String effect) { } /** - * Get the results value. + * Get non-compliance summary for the policy definition. * * @return the results value */ @@ -108,7 +108,7 @@ public SummaryResults results() { } /** - * Set the results value. + * Set non-compliance summary for the policy definition. * * @param results the results value to set * @return the PolicyDefinitionSummary object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryFailure.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryFailure.java index beda033d97e0..4caf9c095cdd 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryFailure.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryFailure.java @@ -21,7 +21,7 @@ public class QueryFailure { private QueryFailureError error; /** - * Get the error value. + * Get error definition. * * @return the error value */ @@ -30,7 +30,7 @@ public QueryFailureError error() { } /** - * Set the error value. + * Set error definition. * * @param error the error value to set * @return the QueryFailure object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryFailureError.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryFailureError.java index 5ab11fe91957..df48a012368b 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryFailureError.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryFailureError.java @@ -18,17 +18,17 @@ public class QueryFailureError { * Service specific error code which serves as the substatus for the HTTP * error code. */ - @JsonProperty(value = "code") + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) private String code; /** * Description of the error. */ - @JsonProperty(value = "message") + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) private String message; /** - * Get the code value. + * Get service specific error code which serves as the substatus for the HTTP error code. * * @return the code value */ @@ -37,18 +37,7 @@ public String code() { } /** - * Set the code value. - * - * @param code the code value to set - * @return the QueryFailureError object itself. - */ - public QueryFailureError withCode(String code) { - this.code = code; - return this; - } - - /** - * Get the message value. + * Get description of the error. * * @return the message value */ @@ -56,15 +45,4 @@ public String message() { return this.message; } - /** - * Set the message value. - * - * @param message the message value to set - * @return the QueryFailureError object itself. - */ - public QueryFailureError withMessage(String message) { - this.message = message; - return this; - } - } diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryOptions.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryOptions.java index 39b59cad3f2a..86ca2dd0dbb6 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryOptions.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/QueryOptions.java @@ -64,7 +64,7 @@ public class QueryOptions { private String apply; /** - * Get the top value. + * Get maximum number of records to return. * * @return the top value */ @@ -73,7 +73,7 @@ public Integer top() { } /** - * Set the top value. + * Set maximum number of records to return. * * @param top the top value to set * @return the QueryOptions object itself. @@ -84,7 +84,7 @@ public QueryOptions withTop(Integer top) { } /** - * Get the orderBy value. + * Get ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". * * @return the orderBy value */ @@ -93,7 +93,7 @@ public String orderBy() { } /** - * Set the orderBy value. + * Set ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". * * @param orderBy the orderBy value to set * @return the QueryOptions object itself. @@ -104,7 +104,7 @@ public QueryOptions withOrderBy(String orderBy) { } /** - * Get the select value. + * Get select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". * * @return the select value */ @@ -113,7 +113,7 @@ public String select() { } /** - * Set the select value. + * Set select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". * * @param select the select value to set * @return the QueryOptions object itself. @@ -124,7 +124,7 @@ public QueryOptions withSelect(String select) { } /** - * Get the from value. + * Get iSO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). * * @return the from value */ @@ -133,7 +133,7 @@ public DateTime from() { } /** - * Set the from value. + * Set iSO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). * * @param from the from value to set * @return the QueryOptions object itself. @@ -144,7 +144,7 @@ public QueryOptions withFrom(DateTime from) { } /** - * Get the to value. + * Get iSO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. * * @return the to value */ @@ -153,7 +153,7 @@ public DateTime to() { } /** - * Set the to value. + * Set iSO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. * * @param to the to value to set * @return the QueryOptions object itself. @@ -164,7 +164,7 @@ public QueryOptions withTo(DateTime to) { } /** - * Get the filter value. + * Get oData filter expression. * * @return the filter value */ @@ -173,7 +173,7 @@ public String filter() { } /** - * Set the filter value. + * Set oData filter expression. * * @param filter the filter value to set * @return the QueryOptions object itself. @@ -184,7 +184,7 @@ public QueryOptions withFilter(String filter) { } /** - * Get the apply value. + * Get oData apply expression for aggregations. * * @return the apply value */ @@ -193,7 +193,7 @@ public String apply() { } /** - * Set the apply value. + * Set oData apply expression for aggregations. * * @param apply the apply value to set * @return the QueryOptions object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/Summary.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/Summary.java index ff24b3476648..ade9fdf75632 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/Summary.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/Summary.java @@ -42,7 +42,7 @@ public class Summary { private List policyAssignments; /** - * Get the odataid value. + * Get oData entity ID; always set to null since summaries do not have an entity ID. * * @return the odataid value */ @@ -51,7 +51,7 @@ public String odataid() { } /** - * Set the odataid value. + * Set oData entity ID; always set to null since summaries do not have an entity ID. * * @param odataid the odataid value to set * @return the Summary object itself. @@ -62,7 +62,7 @@ public Summary withOdataid(String odataid) { } /** - * Get the odatacontext value. + * Get oData context string; used by OData clients to resolve type information based on metadata. * * @return the odatacontext value */ @@ -71,7 +71,7 @@ public String odatacontext() { } /** - * Set the odatacontext value. + * Set oData context string; used by OData clients to resolve type information based on metadata. * * @param odatacontext the odatacontext value to set * @return the Summary object itself. @@ -82,7 +82,7 @@ public Summary withOdatacontext(String odatacontext) { } /** - * Get the results value. + * Get non-compliance summary for all policy assignments. * * @return the results value */ @@ -91,7 +91,7 @@ public SummaryResults results() { } /** - * Set the results value. + * Set non-compliance summary for all policy assignments. * * @param results the results value to set * @return the Summary object itself. @@ -102,7 +102,7 @@ public Summary withResults(SummaryResults results) { } /** - * Get the policyAssignments value. + * Get policy assignments summary. * * @return the policyAssignments value */ @@ -111,7 +111,7 @@ public List policyAssignments() { } /** - * Set the policyAssignments value. + * Set policy assignments summary. * * @param policyAssignments the policyAssignments value to set * @return the Summary object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/SummaryResults.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/SummaryResults.java index 6a2214e95bfd..0b4549f3cdfd 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/SummaryResults.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/SummaryResults.java @@ -34,7 +34,7 @@ public class SummaryResults { private Integer nonCompliantPolicies; /** - * Get the queryResultsUri value. + * Get hTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the non-compliance summary. * * @return the queryResultsUri value */ @@ -43,7 +43,7 @@ public String queryResultsUri() { } /** - * Set the queryResultsUri value. + * Set hTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the non-compliance summary. * * @param queryResultsUri the queryResultsUri value to set * @return the SummaryResults object itself. @@ -54,7 +54,7 @@ public SummaryResults withQueryResultsUri(String queryResultsUri) { } /** - * Get the nonCompliantResources value. + * Get number of non-compliant resources. * * @return the nonCompliantResources value */ @@ -63,7 +63,7 @@ public Integer nonCompliantResources() { } /** - * Set the nonCompliantResources value. + * Set number of non-compliant resources. * * @param nonCompliantResources the nonCompliantResources value to set * @return the SummaryResults object itself. @@ -74,7 +74,7 @@ public SummaryResults withNonCompliantResources(Integer nonCompliantResources) { } /** - * Get the nonCompliantPolicies value. + * Get number of non-compliant policies. * * @return the nonCompliantPolicies value */ @@ -83,7 +83,7 @@ public Integer nonCompliantPolicies() { } /** - * Set the nonCompliantPolicies value. + * Set number of non-compliant policies. * * @param nonCompliantPolicies the nonCompliantPolicies value to set * @return the SummaryResults object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/OperationInner.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/OperationInner.java index d74364feade4..8d22efd4fa1c 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/OperationInner.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/OperationInner.java @@ -28,7 +28,7 @@ public class OperationInner { private OperationDisplay display; /** - * Get the name value. + * Get operation name. * * @return the name value */ @@ -37,7 +37,7 @@ public String name() { } /** - * Set the name value. + * Set operation name. * * @param name the name value to set * @return the OperationInner object itself. @@ -48,7 +48,7 @@ public OperationInner withName(String name) { } /** - * Get the display value. + * Get display metadata associated with the operation. * * @return the display value */ @@ -57,7 +57,7 @@ public OperationDisplay display() { } /** - * Set the display value. + * Set display metadata associated with the operation. * * @param display the display value to set * @return the OperationInner object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/OperationsListResultsInner.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/OperationsListResultsInner.java index ce6e0866bc24..13be27de87c6 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/OperationsListResultsInner.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/OperationsListResultsInner.java @@ -28,7 +28,7 @@ public class OperationsListResultsInner { private List value; /** - * Get the odatacount value. + * Get oData entity count; represents the number of operations returned. * * @return the odatacount value */ @@ -37,7 +37,7 @@ public Integer odatacount() { } /** - * Set the odatacount value. + * Set oData entity count; represents the number of operations returned. * * @param odatacount the odatacount value to set * @return the OperationsListResultsInner object itself. @@ -48,7 +48,7 @@ public OperationsListResultsInner withOdatacount(Integer odatacount) { } /** - * Get the value value. + * Get list of available operations. * * @return the value value */ @@ -57,7 +57,7 @@ public List value() { } /** - * Set the value value. + * Set list of available operations. * * @param value the value value to set * @return the OperationsListResultsInner object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventInner.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventInner.java index d7fed6037b93..de72cd202840 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventInner.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventInner.java @@ -180,7 +180,7 @@ public class PolicyEventInner { private String policySetDefinitionParameters; /** - * Comma seperated list of management group IDs, which represent the + * Comma separated list of management group IDs, which represent the * hierarchy of the management groups the resource is under. */ @JsonProperty(value = "managementGroupIds") @@ -207,7 +207,7 @@ public class PolicyEventInner { private String principalOid; /** - * Get the additionalProperties value. + * Get unmatched properties from the message are deserialized this collection. * * @return the additionalProperties value */ @@ -216,7 +216,7 @@ public Map additionalProperties() { } /** - * Set the additionalProperties value. + * Set unmatched properties from the message are deserialized this collection. * * @param additionalProperties the additionalProperties value to set * @return the PolicyEventInner object itself. @@ -227,7 +227,7 @@ public PolicyEventInner withAdditionalProperties(Map additionalP } /** - * Get the odataid value. + * Get oData entity ID; always set to null since policy event records do not have an entity ID. * * @return the odataid value */ @@ -236,7 +236,7 @@ public String odataid() { } /** - * Set the odataid value. + * Set oData entity ID; always set to null since policy event records do not have an entity ID. * * @param odataid the odataid value to set * @return the PolicyEventInner object itself. @@ -247,7 +247,7 @@ public PolicyEventInner withOdataid(String odataid) { } /** - * Get the odatacontext value. + * Get oData context string; used by OData clients to resolve type information based on metadata. * * @return the odatacontext value */ @@ -256,7 +256,7 @@ public String odatacontext() { } /** - * Set the odatacontext value. + * Set oData context string; used by OData clients to resolve type information based on metadata. * * @param odatacontext the odatacontext value to set * @return the PolicyEventInner object itself. @@ -267,7 +267,7 @@ public PolicyEventInner withOdatacontext(String odatacontext) { } /** - * Get the timestamp value. + * Get timestamp for the policy event record. * * @return the timestamp value */ @@ -276,7 +276,7 @@ public DateTime timestamp() { } /** - * Set the timestamp value. + * Set timestamp for the policy event record. * * @param timestamp the timestamp value to set * @return the PolicyEventInner object itself. @@ -287,7 +287,7 @@ public PolicyEventInner withTimestamp(DateTime timestamp) { } /** - * Get the resourceId value. + * Get resource ID. * * @return the resourceId value */ @@ -296,7 +296,7 @@ public String resourceId() { } /** - * Set the resourceId value. + * Set resource ID. * * @param resourceId the resourceId value to set * @return the PolicyEventInner object itself. @@ -307,7 +307,7 @@ public PolicyEventInner withResourceId(String resourceId) { } /** - * Get the policyAssignmentId value. + * Get policy assignment ID. * * @return the policyAssignmentId value */ @@ -316,7 +316,7 @@ public String policyAssignmentId() { } /** - * Set the policyAssignmentId value. + * Set policy assignment ID. * * @param policyAssignmentId the policyAssignmentId value to set * @return the PolicyEventInner object itself. @@ -327,7 +327,7 @@ public PolicyEventInner withPolicyAssignmentId(String policyAssignmentId) { } /** - * Get the policyDefinitionId value. + * Get policy definition ID. * * @return the policyDefinitionId value */ @@ -336,7 +336,7 @@ public String policyDefinitionId() { } /** - * Set the policyDefinitionId value. + * Set policy definition ID. * * @param policyDefinitionId the policyDefinitionId value to set * @return the PolicyEventInner object itself. @@ -347,7 +347,7 @@ public PolicyEventInner withPolicyDefinitionId(String policyDefinitionId) { } /** - * Get the effectiveParameters value. + * Get effective parameters for the policy assignment. * * @return the effectiveParameters value */ @@ -356,7 +356,7 @@ public String effectiveParameters() { } /** - * Set the effectiveParameters value. + * Set effective parameters for the policy assignment. * * @param effectiveParameters the effectiveParameters value to set * @return the PolicyEventInner object itself. @@ -367,7 +367,7 @@ public PolicyEventInner withEffectiveParameters(String effectiveParameters) { } /** - * Get the isCompliant value. + * Get flag which states whether the resource is compliant against the policy assignment it was evaluated against. * * @return the isCompliant value */ @@ -376,7 +376,7 @@ public Boolean isCompliant() { } /** - * Set the isCompliant value. + * Set flag which states whether the resource is compliant against the policy assignment it was evaluated against. * * @param isCompliant the isCompliant value to set * @return the PolicyEventInner object itself. @@ -387,7 +387,7 @@ public PolicyEventInner withIsCompliant(Boolean isCompliant) { } /** - * Get the subscriptionId value. + * Get subscription ID. * * @return the subscriptionId value */ @@ -396,7 +396,7 @@ public String subscriptionId() { } /** - * Set the subscriptionId value. + * Set subscription ID. * * @param subscriptionId the subscriptionId value to set * @return the PolicyEventInner object itself. @@ -407,7 +407,7 @@ public PolicyEventInner withSubscriptionId(String subscriptionId) { } /** - * Get the resourceType value. + * Get resource type. * * @return the resourceType value */ @@ -416,7 +416,7 @@ public String resourceType() { } /** - * Set the resourceType value. + * Set resource type. * * @param resourceType the resourceType value to set * @return the PolicyEventInner object itself. @@ -427,7 +427,7 @@ public PolicyEventInner withResourceType(String resourceType) { } /** - * Get the resourceLocation value. + * Get resource location. * * @return the resourceLocation value */ @@ -436,7 +436,7 @@ public String resourceLocation() { } /** - * Set the resourceLocation value. + * Set resource location. * * @param resourceLocation the resourceLocation value to set * @return the PolicyEventInner object itself. @@ -447,7 +447,7 @@ public PolicyEventInner withResourceLocation(String resourceLocation) { } /** - * Get the resourceGroup value. + * Get resource group name. * * @return the resourceGroup value */ @@ -456,7 +456,7 @@ public String resourceGroup() { } /** - * Set the resourceGroup value. + * Set resource group name. * * @param resourceGroup the resourceGroup value to set * @return the PolicyEventInner object itself. @@ -467,7 +467,7 @@ public PolicyEventInner withResourceGroup(String resourceGroup) { } /** - * Get the resourceTags value. + * Get list of resource tags. * * @return the resourceTags value */ @@ -476,7 +476,7 @@ public String resourceTags() { } /** - * Set the resourceTags value. + * Set list of resource tags. * * @param resourceTags the resourceTags value to set * @return the PolicyEventInner object itself. @@ -487,7 +487,7 @@ public PolicyEventInner withResourceTags(String resourceTags) { } /** - * Get the policyAssignmentName value. + * Get policy assignment name. * * @return the policyAssignmentName value */ @@ -496,7 +496,7 @@ public String policyAssignmentName() { } /** - * Set the policyAssignmentName value. + * Set policy assignment name. * * @param policyAssignmentName the policyAssignmentName value to set * @return the PolicyEventInner object itself. @@ -507,7 +507,7 @@ public PolicyEventInner withPolicyAssignmentName(String policyAssignmentName) { } /** - * Get the policyAssignmentOwner value. + * Get policy assignment owner. * * @return the policyAssignmentOwner value */ @@ -516,7 +516,7 @@ public String policyAssignmentOwner() { } /** - * Set the policyAssignmentOwner value. + * Set policy assignment owner. * * @param policyAssignmentOwner the policyAssignmentOwner value to set * @return the PolicyEventInner object itself. @@ -527,7 +527,7 @@ public PolicyEventInner withPolicyAssignmentOwner(String policyAssignmentOwner) } /** - * Get the policyAssignmentParameters value. + * Get policy assignment parameters. * * @return the policyAssignmentParameters value */ @@ -536,7 +536,7 @@ public String policyAssignmentParameters() { } /** - * Set the policyAssignmentParameters value. + * Set policy assignment parameters. * * @param policyAssignmentParameters the policyAssignmentParameters value to set * @return the PolicyEventInner object itself. @@ -547,7 +547,7 @@ public PolicyEventInner withPolicyAssignmentParameters(String policyAssignmentPa } /** - * Get the policyAssignmentScope value. + * Get policy assignment scope. * * @return the policyAssignmentScope value */ @@ -556,7 +556,7 @@ public String policyAssignmentScope() { } /** - * Set the policyAssignmentScope value. + * Set policy assignment scope. * * @param policyAssignmentScope the policyAssignmentScope value to set * @return the PolicyEventInner object itself. @@ -567,7 +567,7 @@ public PolicyEventInner withPolicyAssignmentScope(String policyAssignmentScope) } /** - * Get the policyDefinitionName value. + * Get policy definition name. * * @return the policyDefinitionName value */ @@ -576,7 +576,7 @@ public String policyDefinitionName() { } /** - * Set the policyDefinitionName value. + * Set policy definition name. * * @param policyDefinitionName the policyDefinitionName value to set * @return the PolicyEventInner object itself. @@ -587,7 +587,7 @@ public PolicyEventInner withPolicyDefinitionName(String policyDefinitionName) { } /** - * Get the policyDefinitionAction value. + * Get policy definition action, i.e. effect. * * @return the policyDefinitionAction value */ @@ -596,7 +596,7 @@ public String policyDefinitionAction() { } /** - * Set the policyDefinitionAction value. + * Set policy definition action, i.e. effect. * * @param policyDefinitionAction the policyDefinitionAction value to set * @return the PolicyEventInner object itself. @@ -607,7 +607,7 @@ public PolicyEventInner withPolicyDefinitionAction(String policyDefinitionAction } /** - * Get the policyDefinitionCategory value. + * Get policy definition category. * * @return the policyDefinitionCategory value */ @@ -616,7 +616,7 @@ public String policyDefinitionCategory() { } /** - * Set the policyDefinitionCategory value. + * Set policy definition category. * * @param policyDefinitionCategory the policyDefinitionCategory value to set * @return the PolicyEventInner object itself. @@ -627,7 +627,7 @@ public PolicyEventInner withPolicyDefinitionCategory(String policyDefinitionCate } /** - * Get the policySetDefinitionId value. + * Get policy set definition ID, if the policy assignment is for a policy set. * * @return the policySetDefinitionId value */ @@ -636,7 +636,7 @@ public String policySetDefinitionId() { } /** - * Set the policySetDefinitionId value. + * Set policy set definition ID, if the policy assignment is for a policy set. * * @param policySetDefinitionId the policySetDefinitionId value to set * @return the PolicyEventInner object itself. @@ -647,7 +647,7 @@ public PolicyEventInner withPolicySetDefinitionId(String policySetDefinitionId) } /** - * Get the policySetDefinitionName value. + * Get policy set definition name, if the policy assignment is for a policy set. * * @return the policySetDefinitionName value */ @@ -656,7 +656,7 @@ public String policySetDefinitionName() { } /** - * Set the policySetDefinitionName value. + * Set policy set definition name, if the policy assignment is for a policy set. * * @param policySetDefinitionName the policySetDefinitionName value to set * @return the PolicyEventInner object itself. @@ -667,7 +667,7 @@ public PolicyEventInner withPolicySetDefinitionName(String policySetDefinitionNa } /** - * Get the policySetDefinitionOwner value. + * Get policy set definition owner, if the policy assignment is for a policy set. * * @return the policySetDefinitionOwner value */ @@ -676,7 +676,7 @@ public String policySetDefinitionOwner() { } /** - * Set the policySetDefinitionOwner value. + * Set policy set definition owner, if the policy assignment is for a policy set. * * @param policySetDefinitionOwner the policySetDefinitionOwner value to set * @return the PolicyEventInner object itself. @@ -687,7 +687,7 @@ public PolicyEventInner withPolicySetDefinitionOwner(String policySetDefinitionO } /** - * Get the policySetDefinitionCategory value. + * Get policy set definition category, if the policy assignment is for a policy set. * * @return the policySetDefinitionCategory value */ @@ -696,7 +696,7 @@ public String policySetDefinitionCategory() { } /** - * Set the policySetDefinitionCategory value. + * Set policy set definition category, if the policy assignment is for a policy set. * * @param policySetDefinitionCategory the policySetDefinitionCategory value to set * @return the PolicyEventInner object itself. @@ -707,7 +707,7 @@ public PolicyEventInner withPolicySetDefinitionCategory(String policySetDefiniti } /** - * Get the policySetDefinitionParameters value. + * Get policy set definition parameters, if the policy assignment is for a policy set. * * @return the policySetDefinitionParameters value */ @@ -716,7 +716,7 @@ public String policySetDefinitionParameters() { } /** - * Set the policySetDefinitionParameters value. + * Set policy set definition parameters, if the policy assignment is for a policy set. * * @param policySetDefinitionParameters the policySetDefinitionParameters value to set * @return the PolicyEventInner object itself. @@ -727,7 +727,7 @@ public PolicyEventInner withPolicySetDefinitionParameters(String policySetDefini } /** - * Get the managementGroupIds value. + * Get comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. * * @return the managementGroupIds value */ @@ -736,7 +736,7 @@ public String managementGroupIds() { } /** - * Set the managementGroupIds value. + * Set comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. * * @param managementGroupIds the managementGroupIds value to set * @return the PolicyEventInner object itself. @@ -747,7 +747,7 @@ public PolicyEventInner withManagementGroupIds(String managementGroupIds) { } /** - * Get the policyDefinitionReferenceId value. + * Get reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. * * @return the policyDefinitionReferenceId value */ @@ -756,7 +756,7 @@ public String policyDefinitionReferenceId() { } /** - * Set the policyDefinitionReferenceId value. + * Set reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. * * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set * @return the PolicyEventInner object itself. @@ -767,7 +767,7 @@ public PolicyEventInner withPolicyDefinitionReferenceId(String policyDefinitionR } /** - * Get the tenantId value. + * Get tenant ID for the policy event record. * * @return the tenantId value */ @@ -776,7 +776,7 @@ public String tenantId() { } /** - * Set the tenantId value. + * Set tenant ID for the policy event record. * * @param tenantId the tenantId value to set * @return the PolicyEventInner object itself. @@ -787,7 +787,7 @@ public PolicyEventInner withTenantId(String tenantId) { } /** - * Get the principalOid value. + * Get principal object ID for the user who initiated the resource operation that triggered the policy event. * * @return the principalOid value */ @@ -796,7 +796,7 @@ public String principalOid() { } /** - * Set the principalOid value. + * Set principal object ID for the user who initiated the resource operation that triggered the policy event. * * @param principalOid the principalOid value to set * @return the PolicyEventInner object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsQueryResultsInner.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsQueryResultsInner.java index 230ef2d8a228..de80da671770 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsQueryResultsInner.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsQueryResultsInner.java @@ -36,7 +36,7 @@ public class PolicyEventsQueryResultsInner { private List value; /** - * Get the odatacontext value. + * Get oData context string; used by OData clients to resolve type information based on metadata. * * @return the odatacontext value */ @@ -45,7 +45,7 @@ public String odatacontext() { } /** - * Set the odatacontext value. + * Set oData context string; used by OData clients to resolve type information based on metadata. * * @param odatacontext the odatacontext value to set * @return the PolicyEventsQueryResultsInner object itself. @@ -56,7 +56,7 @@ public PolicyEventsQueryResultsInner withOdatacontext(String odatacontext) { } /** - * Get the odatacount value. + * Get oData entity count; represents the number of policy event records returned. * * @return the odatacount value */ @@ -65,7 +65,7 @@ public Integer odatacount() { } /** - * Set the odatacount value. + * Set oData entity count; represents the number of policy event records returned. * * @param odatacount the odatacount value to set * @return the PolicyEventsQueryResultsInner object itself. @@ -76,7 +76,7 @@ public PolicyEventsQueryResultsInner withOdatacount(Integer odatacount) { } /** - * Get the value value. + * Get query results. * * @return the value value */ @@ -85,7 +85,7 @@ public List value() { } /** - * Set the value value. + * Set query results. * * @param value the value value to set * @return the PolicyEventsQueryResultsInner object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyInsightsManager.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyInsightsManager.java index 92a91f68bb7b..38d9c20f48ba 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyInsightsManager.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyInsightsManager.java @@ -11,6 +11,8 @@ import com.microsoft.azure.AzureEnvironment; import com.microsoft.azure.AzureResponseBuilder; import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; import com.microsoft.azure.arm.resources.AzureConfigurable; import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStateInner.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStateInner.java index 95dab2022a18..8c0be8d3d4e1 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStateInner.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStateInner.java @@ -180,7 +180,7 @@ public class PolicyStateInner { private String policySetDefinitionParameters; /** - * Comma seperated list of management group IDs, which represent the + * Comma separated list of management group IDs, which represent the * hierarchy of the management groups the resource is under. */ @JsonProperty(value = "managementGroupIds") @@ -194,7 +194,7 @@ public class PolicyStateInner { private String policyDefinitionReferenceId; /** - * Get the additionalProperties value. + * Get unmatched properties from the message are deserialized this collection. * * @return the additionalProperties value */ @@ -203,7 +203,7 @@ public Map additionalProperties() { } /** - * Set the additionalProperties value. + * Set unmatched properties from the message are deserialized this collection. * * @param additionalProperties the additionalProperties value to set * @return the PolicyStateInner object itself. @@ -214,7 +214,7 @@ public PolicyStateInner withAdditionalProperties(Map additionalP } /** - * Get the odataid value. + * Get oData entity ID; always set to null since policy state records do not have an entity ID. * * @return the odataid value */ @@ -223,7 +223,7 @@ public String odataid() { } /** - * Set the odataid value. + * Set oData entity ID; always set to null since policy state records do not have an entity ID. * * @param odataid the odataid value to set * @return the PolicyStateInner object itself. @@ -234,7 +234,7 @@ public PolicyStateInner withOdataid(String odataid) { } /** - * Get the odatacontext value. + * Get oData context string; used by OData clients to resolve type information based on metadata. * * @return the odatacontext value */ @@ -243,7 +243,7 @@ public String odatacontext() { } /** - * Set the odatacontext value. + * Set oData context string; used by OData clients to resolve type information based on metadata. * * @param odatacontext the odatacontext value to set * @return the PolicyStateInner object itself. @@ -254,7 +254,7 @@ public PolicyStateInner withOdatacontext(String odatacontext) { } /** - * Get the timestamp value. + * Get timestamp for the policy state record. * * @return the timestamp value */ @@ -263,7 +263,7 @@ public DateTime timestamp() { } /** - * Set the timestamp value. + * Set timestamp for the policy state record. * * @param timestamp the timestamp value to set * @return the PolicyStateInner object itself. @@ -274,7 +274,7 @@ public PolicyStateInner withTimestamp(DateTime timestamp) { } /** - * Get the resourceId value. + * Get resource ID. * * @return the resourceId value */ @@ -283,7 +283,7 @@ public String resourceId() { } /** - * Set the resourceId value. + * Set resource ID. * * @param resourceId the resourceId value to set * @return the PolicyStateInner object itself. @@ -294,7 +294,7 @@ public PolicyStateInner withResourceId(String resourceId) { } /** - * Get the policyAssignmentId value. + * Get policy assignment ID. * * @return the policyAssignmentId value */ @@ -303,7 +303,7 @@ public String policyAssignmentId() { } /** - * Set the policyAssignmentId value. + * Set policy assignment ID. * * @param policyAssignmentId the policyAssignmentId value to set * @return the PolicyStateInner object itself. @@ -314,7 +314,7 @@ public PolicyStateInner withPolicyAssignmentId(String policyAssignmentId) { } /** - * Get the policyDefinitionId value. + * Get policy definition ID. * * @return the policyDefinitionId value */ @@ -323,7 +323,7 @@ public String policyDefinitionId() { } /** - * Set the policyDefinitionId value. + * Set policy definition ID. * * @param policyDefinitionId the policyDefinitionId value to set * @return the PolicyStateInner object itself. @@ -334,7 +334,7 @@ public PolicyStateInner withPolicyDefinitionId(String policyDefinitionId) { } /** - * Get the effectiveParameters value. + * Get effective parameters for the policy assignment. * * @return the effectiveParameters value */ @@ -343,7 +343,7 @@ public String effectiveParameters() { } /** - * Set the effectiveParameters value. + * Set effective parameters for the policy assignment. * * @param effectiveParameters the effectiveParameters value to set * @return the PolicyStateInner object itself. @@ -354,7 +354,7 @@ public PolicyStateInner withEffectiveParameters(String effectiveParameters) { } /** - * Get the isCompliant value. + * Get flag which states whether the resource is compliant against the policy assignment it was evaluated against. * * @return the isCompliant value */ @@ -363,7 +363,7 @@ public Boolean isCompliant() { } /** - * Set the isCompliant value. + * Set flag which states whether the resource is compliant against the policy assignment it was evaluated against. * * @param isCompliant the isCompliant value to set * @return the PolicyStateInner object itself. @@ -374,7 +374,7 @@ public PolicyStateInner withIsCompliant(Boolean isCompliant) { } /** - * Get the subscriptionId value. + * Get subscription ID. * * @return the subscriptionId value */ @@ -383,7 +383,7 @@ public String subscriptionId() { } /** - * Set the subscriptionId value. + * Set subscription ID. * * @param subscriptionId the subscriptionId value to set * @return the PolicyStateInner object itself. @@ -394,7 +394,7 @@ public PolicyStateInner withSubscriptionId(String subscriptionId) { } /** - * Get the resourceType value. + * Get resource type. * * @return the resourceType value */ @@ -403,7 +403,7 @@ public String resourceType() { } /** - * Set the resourceType value. + * Set resource type. * * @param resourceType the resourceType value to set * @return the PolicyStateInner object itself. @@ -414,7 +414,7 @@ public PolicyStateInner withResourceType(String resourceType) { } /** - * Get the resourceLocation value. + * Get resource location. * * @return the resourceLocation value */ @@ -423,7 +423,7 @@ public String resourceLocation() { } /** - * Set the resourceLocation value. + * Set resource location. * * @param resourceLocation the resourceLocation value to set * @return the PolicyStateInner object itself. @@ -434,7 +434,7 @@ public PolicyStateInner withResourceLocation(String resourceLocation) { } /** - * Get the resourceGroup value. + * Get resource group name. * * @return the resourceGroup value */ @@ -443,7 +443,7 @@ public String resourceGroup() { } /** - * Set the resourceGroup value. + * Set resource group name. * * @param resourceGroup the resourceGroup value to set * @return the PolicyStateInner object itself. @@ -454,7 +454,7 @@ public PolicyStateInner withResourceGroup(String resourceGroup) { } /** - * Get the resourceTags value. + * Get list of resource tags. * * @return the resourceTags value */ @@ -463,7 +463,7 @@ public String resourceTags() { } /** - * Set the resourceTags value. + * Set list of resource tags. * * @param resourceTags the resourceTags value to set * @return the PolicyStateInner object itself. @@ -474,7 +474,7 @@ public PolicyStateInner withResourceTags(String resourceTags) { } /** - * Get the policyAssignmentName value. + * Get policy assignment name. * * @return the policyAssignmentName value */ @@ -483,7 +483,7 @@ public String policyAssignmentName() { } /** - * Set the policyAssignmentName value. + * Set policy assignment name. * * @param policyAssignmentName the policyAssignmentName value to set * @return the PolicyStateInner object itself. @@ -494,7 +494,7 @@ public PolicyStateInner withPolicyAssignmentName(String policyAssignmentName) { } /** - * Get the policyAssignmentOwner value. + * Get policy assignment owner. * * @return the policyAssignmentOwner value */ @@ -503,7 +503,7 @@ public String policyAssignmentOwner() { } /** - * Set the policyAssignmentOwner value. + * Set policy assignment owner. * * @param policyAssignmentOwner the policyAssignmentOwner value to set * @return the PolicyStateInner object itself. @@ -514,7 +514,7 @@ public PolicyStateInner withPolicyAssignmentOwner(String policyAssignmentOwner) } /** - * Get the policyAssignmentParameters value. + * Get policy assignment parameters. * * @return the policyAssignmentParameters value */ @@ -523,7 +523,7 @@ public String policyAssignmentParameters() { } /** - * Set the policyAssignmentParameters value. + * Set policy assignment parameters. * * @param policyAssignmentParameters the policyAssignmentParameters value to set * @return the PolicyStateInner object itself. @@ -534,7 +534,7 @@ public PolicyStateInner withPolicyAssignmentParameters(String policyAssignmentPa } /** - * Get the policyAssignmentScope value. + * Get policy assignment scope. * * @return the policyAssignmentScope value */ @@ -543,7 +543,7 @@ public String policyAssignmentScope() { } /** - * Set the policyAssignmentScope value. + * Set policy assignment scope. * * @param policyAssignmentScope the policyAssignmentScope value to set * @return the PolicyStateInner object itself. @@ -554,7 +554,7 @@ public PolicyStateInner withPolicyAssignmentScope(String policyAssignmentScope) } /** - * Get the policyDefinitionName value. + * Get policy definition name. * * @return the policyDefinitionName value */ @@ -563,7 +563,7 @@ public String policyDefinitionName() { } /** - * Set the policyDefinitionName value. + * Set policy definition name. * * @param policyDefinitionName the policyDefinitionName value to set * @return the PolicyStateInner object itself. @@ -574,7 +574,7 @@ public PolicyStateInner withPolicyDefinitionName(String policyDefinitionName) { } /** - * Get the policyDefinitionAction value. + * Get policy definition action, i.e. effect. * * @return the policyDefinitionAction value */ @@ -583,7 +583,7 @@ public String policyDefinitionAction() { } /** - * Set the policyDefinitionAction value. + * Set policy definition action, i.e. effect. * * @param policyDefinitionAction the policyDefinitionAction value to set * @return the PolicyStateInner object itself. @@ -594,7 +594,7 @@ public PolicyStateInner withPolicyDefinitionAction(String policyDefinitionAction } /** - * Get the policyDefinitionCategory value. + * Get policy definition category. * * @return the policyDefinitionCategory value */ @@ -603,7 +603,7 @@ public String policyDefinitionCategory() { } /** - * Set the policyDefinitionCategory value. + * Set policy definition category. * * @param policyDefinitionCategory the policyDefinitionCategory value to set * @return the PolicyStateInner object itself. @@ -614,7 +614,7 @@ public PolicyStateInner withPolicyDefinitionCategory(String policyDefinitionCate } /** - * Get the policySetDefinitionId value. + * Get policy set definition ID, if the policy assignment is for a policy set. * * @return the policySetDefinitionId value */ @@ -623,7 +623,7 @@ public String policySetDefinitionId() { } /** - * Set the policySetDefinitionId value. + * Set policy set definition ID, if the policy assignment is for a policy set. * * @param policySetDefinitionId the policySetDefinitionId value to set * @return the PolicyStateInner object itself. @@ -634,7 +634,7 @@ public PolicyStateInner withPolicySetDefinitionId(String policySetDefinitionId) } /** - * Get the policySetDefinitionName value. + * Get policy set definition name, if the policy assignment is for a policy set. * * @return the policySetDefinitionName value */ @@ -643,7 +643,7 @@ public String policySetDefinitionName() { } /** - * Set the policySetDefinitionName value. + * Set policy set definition name, if the policy assignment is for a policy set. * * @param policySetDefinitionName the policySetDefinitionName value to set * @return the PolicyStateInner object itself. @@ -654,7 +654,7 @@ public PolicyStateInner withPolicySetDefinitionName(String policySetDefinitionNa } /** - * Get the policySetDefinitionOwner value. + * Get policy set definition owner, if the policy assignment is for a policy set. * * @return the policySetDefinitionOwner value */ @@ -663,7 +663,7 @@ public String policySetDefinitionOwner() { } /** - * Set the policySetDefinitionOwner value. + * Set policy set definition owner, if the policy assignment is for a policy set. * * @param policySetDefinitionOwner the policySetDefinitionOwner value to set * @return the PolicyStateInner object itself. @@ -674,7 +674,7 @@ public PolicyStateInner withPolicySetDefinitionOwner(String policySetDefinitionO } /** - * Get the policySetDefinitionCategory value. + * Get policy set definition category, if the policy assignment is for a policy set. * * @return the policySetDefinitionCategory value */ @@ -683,7 +683,7 @@ public String policySetDefinitionCategory() { } /** - * Set the policySetDefinitionCategory value. + * Set policy set definition category, if the policy assignment is for a policy set. * * @param policySetDefinitionCategory the policySetDefinitionCategory value to set * @return the PolicyStateInner object itself. @@ -694,7 +694,7 @@ public PolicyStateInner withPolicySetDefinitionCategory(String policySetDefiniti } /** - * Get the policySetDefinitionParameters value. + * Get policy set definition parameters, if the policy assignment is for a policy set. * * @return the policySetDefinitionParameters value */ @@ -703,7 +703,7 @@ public String policySetDefinitionParameters() { } /** - * Set the policySetDefinitionParameters value. + * Set policy set definition parameters, if the policy assignment is for a policy set. * * @param policySetDefinitionParameters the policySetDefinitionParameters value to set * @return the PolicyStateInner object itself. @@ -714,7 +714,7 @@ public PolicyStateInner withPolicySetDefinitionParameters(String policySetDefini } /** - * Get the managementGroupIds value. + * Get comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. * * @return the managementGroupIds value */ @@ -723,7 +723,7 @@ public String managementGroupIds() { } /** - * Set the managementGroupIds value. + * Set comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. * * @param managementGroupIds the managementGroupIds value to set * @return the PolicyStateInner object itself. @@ -734,7 +734,7 @@ public PolicyStateInner withManagementGroupIds(String managementGroupIds) { } /** - * Get the policyDefinitionReferenceId value. + * Get reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. * * @return the policyDefinitionReferenceId value */ @@ -743,7 +743,7 @@ public String policyDefinitionReferenceId() { } /** - * Set the policyDefinitionReferenceId value. + * Set reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. * * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set * @return the PolicyStateInner object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesQueryResultsInner.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesQueryResultsInner.java index ec2abe0f9bd5..730e6bc06a2b 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesQueryResultsInner.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesQueryResultsInner.java @@ -36,7 +36,7 @@ public class PolicyStatesQueryResultsInner { private List value; /** - * Get the odatacontext value. + * Get oData context string; used by OData clients to resolve type information based on metadata. * * @return the odatacontext value */ @@ -45,7 +45,7 @@ public String odatacontext() { } /** - * Set the odatacontext value. + * Set oData context string; used by OData clients to resolve type information based on metadata. * * @param odatacontext the odatacontext value to set * @return the PolicyStatesQueryResultsInner object itself. @@ -56,7 +56,7 @@ public PolicyStatesQueryResultsInner withOdatacontext(String odatacontext) { } /** - * Get the odatacount value. + * Get oData entity count; represents the number of policy state records returned. * * @return the odatacount value */ @@ -65,7 +65,7 @@ public Integer odatacount() { } /** - * Set the odatacount value. + * Set oData entity count; represents the number of policy state records returned. * * @param odatacount the odatacount value to set * @return the PolicyStatesQueryResultsInner object itself. @@ -76,7 +76,7 @@ public PolicyStatesQueryResultsInner withOdatacount(Integer odatacount) { } /** - * Get the value value. + * Get query results. * * @return the value value */ @@ -85,7 +85,7 @@ public List value() { } /** - * Set the value value. + * Set query results. * * @param value the value value to set * @return the PolicyStatesQueryResultsInner object itself. diff --git a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/SummarizeResultsInner.java b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/SummarizeResultsInner.java index be6ac29ed662..03df7898859f 100644 --- a/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/SummarizeResultsInner.java +++ b/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/SummarizeResultsInner.java @@ -37,7 +37,7 @@ public class SummarizeResultsInner { private List value; /** - * Get the odatacontext value. + * Get oData context string; used by OData clients to resolve type information based on metadata. * * @return the odatacontext value */ @@ -46,7 +46,7 @@ public String odatacontext() { } /** - * Set the odatacontext value. + * Set oData context string; used by OData clients to resolve type information based on metadata. * * @param odatacontext the odatacontext value to set * @return the SummarizeResultsInner object itself. @@ -57,7 +57,7 @@ public SummarizeResultsInner withOdatacontext(String odatacontext) { } /** - * Get the odatacount value. + * Get oData entity count; represents the number of summaries returned; always set to 1. * * @return the odatacount value */ @@ -66,7 +66,7 @@ public Integer odatacount() { } /** - * Set the odatacount value. + * Set oData entity count; represents the number of summaries returned; always set to 1. * * @param odatacount the odatacount value to set * @return the SummarizeResultsInner object itself. @@ -77,7 +77,7 @@ public SummarizeResultsInner withOdatacount(Integer odatacount) { } /** - * Get the value value. + * Get summarize action results. * * @return the value value */ @@ -86,7 +86,7 @@ public List value() { } /** - * Set the value value. + * Set summarize action results. * * @param value the value value to set * @return the SummarizeResultsInner object itself. diff --git a/policyinsights/resource-manager/v2018_07_01_preview/pom.xml b/policyinsights/resource-manager/v2018_07_01_preview/pom.xml new file mode 100644 index 000000000000..00f8370e01ea --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.policyinsights.v2018_07_01_preview + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-policyinsights + 1.0.0-beta + jar + Microsoft Azure SDK for PolicyInsights Management + This package contains Microsoft PolicyInsights Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorDefinition.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorDefinition.java new file mode 100644 index 000000000000..63095c154a5f --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorDefinition.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error definition. + */ +public class ErrorDefinition { + /** + * Service specific error code which serves as the substatus for the HTTP + * error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Description of the error. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Internal error details. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * Additional scenario specific error details. + */ + @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY) + private List additionalInfo; + + /** + * Get service specific error code which serves as the substatus for the HTTP error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get description of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get internal error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Get additional scenario specific error details. + * + * @return the additionalInfo value + */ + public List additionalInfo() { + return this.additionalInfo; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorResponse.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorResponse.java new file mode 100644 index 000000000000..566f169b0430 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorResponse.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response. + */ +public class ErrorResponse { + /** + * The error details. + */ + @JsonProperty(value = "error") + private ErrorDefinition error; + + /** + * Get the error details. + * + * @return the error value + */ + public ErrorDefinition error() { + return this.error; + } + + /** + * Set the error details. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDefinition error) { + this.error = error; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorResponseException.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorResponseException.java new file mode 100644 index 000000000000..863bfb0b3d19 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ErrorResponseException.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.v2018_07_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ExpressionEvaluationDetails.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ExpressionEvaluationDetails.java new file mode 100644 index 000000000000..ed9f8805e2a3 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/ExpressionEvaluationDetails.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Evaluation details of policy language expressions. + */ +public class ExpressionEvaluationDetails { + /** + * Evaluation result. + */ + @JsonProperty(value = "result") + private String result; + + /** + * Expression evaluated. + */ + @JsonProperty(value = "expression") + private String expression; + + /** + * Property path if the expression is a field or an aliase. + */ + @JsonProperty(value = "path") + private String path; + + /** + * Value of the expression. + */ + @JsonProperty(value = "expressionValue") + private String expressionValue; + + /** + * Target value to be compared with the expression value. + */ + @JsonProperty(value = "targetValue") + private String targetValue; + + /** + * Operator to compare the expression value and the target value. + */ + @JsonProperty(value = "operator") + private String operator; + + /** + * Get evaluation result. + * + * @return the result value + */ + public String result() { + return this.result; + } + + /** + * Set evaluation result. + * + * @param result the result value to set + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withResult(String result) { + this.result = result; + return this; + } + + /** + * Get expression evaluated. + * + * @return the expression value + */ + public String expression() { + return this.expression; + } + + /** + * Set expression evaluated. + * + * @param expression the expression value to set + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withExpression(String expression) { + this.expression = expression; + return this; + } + + /** + * Get property path if the expression is a field or an aliase. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set property path if the expression is a field or an aliase. + * + * @param path the path value to set + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withPath(String path) { + this.path = path; + return this; + } + + /** + * Get value of the expression. + * + * @return the expressionValue value + */ + public String expressionValue() { + return this.expressionValue; + } + + /** + * Set value of the expression. + * + * @param expressionValue the expressionValue value to set + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withExpressionValue(String expressionValue) { + this.expressionValue = expressionValue; + return this; + } + + /** + * Get target value to be compared with the expression value. + * + * @return the targetValue value + */ + public String targetValue() { + return this.targetValue; + } + + /** + * Set target value to be compared with the expression value. + * + * @param targetValue the targetValue value to set + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withTargetValue(String targetValue) { + this.targetValue = targetValue; + return this; + } + + /** + * Get operator to compare the expression value and the target value. + * + * @return the operator value + */ + public String operator() { + return this.operator; + } + + /** + * Set operator to compare the expression value and the target value. + * + * @param operator the operator value to set + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withOperator(String operator) { + this.operator = operator; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/IfNotExistsEvaluationDetails.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/IfNotExistsEvaluationDetails.java new file mode 100644 index 000000000000..e8090479b098 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/IfNotExistsEvaluationDetails.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Evaluation details of IfNotExists effect. + */ +public class IfNotExistsEvaluationDetails { + /** + * ID of the last evaluated resource for IfNotExists effect. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Total number of resources to which the existence condition is + * applicable. + */ + @JsonProperty(value = "totalResources") + private Integer totalResources; + + /** + * Get iD of the last evaluated resource for IfNotExists effect. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set iD of the last evaluated resource for IfNotExists effect. + * + * @param resourceId the resourceId value to set + * @return the IfNotExistsEvaluationDetails object itself. + */ + public IfNotExistsEvaluationDetails withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get total number of resources to which the existence condition is applicable. + * + * @return the totalResources value + */ + public Integer totalResources() { + return this.totalResources; + } + + /** + * Set total number of resources to which the existence condition is applicable. + * + * @param totalResources the totalResources value to set + * @return the IfNotExistsEvaluationDetails object itself. + */ + public IfNotExistsEvaluationDetails withTotalResources(Integer totalResources) { + this.totalResources = totalResources; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/OperationDisplay.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/OperationDisplay.java new file mode 100644 index 000000000000..726b3c310a62 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Resource provider name. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource name on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation name. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Operation description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get resource provider name. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set resource provider name. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource name on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource name on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation name. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set operation description. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Operations.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Operations.java new file mode 100644 index 000000000000..12fa57f412d4 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists available operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/OperationsListResults.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/OperationsListResults.java new file mode 100644 index 000000000000..c3ac955ee24d --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/OperationsListResults.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.OperationsListResultsInner; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.OperationInner; +import java.util.List; + +/** + * Type representing OperationsListResults. + */ +public interface OperationsListResults extends HasInner, HasManager { + /** + * @return the odatacount value. + */ + Integer odatacount(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyAssignmentSummary.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyAssignmentSummary.java new file mode 100644 index 000000000000..2f02103ae658 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyAssignmentSummary.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy assignment summary. + */ +public class PolicyAssignmentSummary { + /** + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /** + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /** + * Non-compliance summary for the policy assignment. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /** + * Policy definitions summary. + */ + @JsonProperty(value = "policyDefinitions") + private List policyDefinitions; + + /** + * Get policy assignment ID. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get non-compliance summary for the policy assignment. + * + * @return the results value + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set non-compliance summary for the policy assignment. + * + * @param results the results value to set + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withResults(SummaryResults results) { + this.results = results; + return this; + } + + /** + * Get policy definitions summary. + * + * @return the policyDefinitions value + */ + public List policyDefinitions() { + return this.policyDefinitions; + } + + /** + * Set policy definitions summary. + * + * @param policyDefinitions the policyDefinitions value to set + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicyDefinitions(List policyDefinitions) { + this.policyDefinitions = policyDefinitions; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyDefinitionSummary.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyDefinitionSummary.java new file mode 100644 index 000000000000..232959a29063 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyDefinitionSummary.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy definition summary. + */ +public class PolicyDefinitionSummary { + /** + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /** + * Policy definition reference ID. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * Policy effect, i.e. policy definition action. + */ + @JsonProperty(value = "effect") + private String effect; + + /** + * Non-compliance summary for the policy definition. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /** + * Get policy definition ID. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get policy definition reference ID. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set policy definition reference ID. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get policy effect, i.e. policy definition action. + * + * @return the effect value + */ + public String effect() { + return this.effect; + } + + /** + * Set policy effect, i.e. policy definition action. + * + * @param effect the effect value to set + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withEffect(String effect) { + this.effect = effect; + return this; + } + + /** + * Get non-compliance summary for the policy definition. + * + * @return the results value + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set non-compliance summary for the policy definition. + * + * @param results the results value to set + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withResults(SummaryResults results) { + this.results = results; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyDetails.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyDetails.java new file mode 100644 index 000000000000..dca5ec543719 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyDetails.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy details. + */ +public class PolicyDetails { + /** + * The ID of the policy definition. + */ + @JsonProperty(value = "policyDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionId; + + /** + * The ID of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentId", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentId; + + /** + * The display name of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentDisplayName; + + /** + * The scope of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentScope", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentScope; + + /** + * The ID of the policy set definition. + */ + @JsonProperty(value = "policySetDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policySetDefinitionId; + + /** + * The policy definition reference ID within the policy set definition. + */ + @JsonProperty(value = "policyDefinitionReferenceId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionReferenceId; + + /** + * Get the ID of the policy definition. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Get the ID of the policy assignment. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Get the display name of the policy assignment. + * + * @return the policyAssignmentDisplayName value + */ + public String policyAssignmentDisplayName() { + return this.policyAssignmentDisplayName; + } + + /** + * Get the scope of the policy assignment. + * + * @return the policyAssignmentScope value + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Get the ID of the policy set definition. + * + * @return the policySetDefinitionId value + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Get the policy definition reference ID within the policy set definition. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvaluationDetails.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvaluationDetails.java new file mode 100644 index 000000000000..3f5c418e2c37 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvaluationDetails.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy evaluation details. + */ +public class PolicyEvaluationDetails { + /** + * Details of the evaluated expressions. + */ + @JsonProperty(value = "evaluatedExpressions") + private List evaluatedExpressions; + + /** + * Evaluation details of IfNotExists effect. + */ + @JsonProperty(value = "ifNotExistsDetails") + private IfNotExistsEvaluationDetails ifNotExistsDetails; + + /** + * Get details of the evaluated expressions. + * + * @return the evaluatedExpressions value + */ + public List evaluatedExpressions() { + return this.evaluatedExpressions; + } + + /** + * Set details of the evaluated expressions. + * + * @param evaluatedExpressions the evaluatedExpressions value to set + * @return the PolicyEvaluationDetails object itself. + */ + public PolicyEvaluationDetails withEvaluatedExpressions(List evaluatedExpressions) { + this.evaluatedExpressions = evaluatedExpressions; + return this; + } + + /** + * Get evaluation details of IfNotExists effect. + * + * @return the ifNotExistsDetails value + */ + public IfNotExistsEvaluationDetails ifNotExistsDetails() { + return this.ifNotExistsDetails; + } + + /** + * Set evaluation details of IfNotExists effect. + * + * @param ifNotExistsDetails the ifNotExistsDetails value to set + * @return the PolicyEvaluationDetails object itself. + */ + public PolicyEvaluationDetails withIfNotExistsDetails(IfNotExistsEvaluationDetails ifNotExistsDetails) { + this.ifNotExistsDetails = ifNotExistsDetails; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java new file mode 100644 index 000000000000..40f6c27a75eb --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEvents.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import rx.Completable; +import rx.Observable; + +/** + * Type representing PolicyEvents. + */ +public interface PolicyEvents { + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listQueryResultsForManagementGroupAsync(String managementGroupName); + + /** + * 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 for the request + */ + Observable listQueryResultsForSubscriptionAsync(String subscriptionId); + + /** + * 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 for the request + */ + Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName); + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listQueryResultsForResourceAsync(String resourceId); + + /** + * 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 for the request + */ + Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName); + + /** + * 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 for the request + */ + Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName); + + /** + * 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 for the request + */ + Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName); + + /** + * 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 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 + */ + Completable getMetadataAsync(String scope); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEventsQueryResults.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEventsQueryResults.java new file mode 100644 index 000000000000..8f58c172ebae --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyEventsQueryResults.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyEventsQueryResultsInner; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyEventInner; +import java.util.List; + +/** + * Type representing PolicyEventsQueryResults. + */ +public interface PolicyEventsQueryResults extends HasInner, HasManager { + /** + * @return the odatacontext value. + */ + String odatacontext(); + + /** + * @return the odatacount value. + */ + Integer odatacount(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java new file mode 100644 index 000000000000..438ace5c725d --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStates.java @@ -0,0 +1,191 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import rx.Completable; +import rx.Observable; + +/** + * Type representing PolicyStates. + */ +public interface PolicyStates { + /** + * 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 for the request + */ + Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName); + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable summarizeForManagementGroupAsync(String managementGroupName); + + /** + * 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 for the request + */ + Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId); + + /** + * Summarizes policy states for 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 + */ + Observable summarizeForSubscriptionAsync(String subscriptionId); + + /** + * 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 for the request + */ + Observable listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName); + + /** + * Summarizes policy states 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 for the request + */ + Observable summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName); + + /** + * 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 for the request + */ + Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId); + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable summarizeForResourceAsync(String resourceId); + + /** + * 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 for the request + */ + Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName); + + /** + * Summarizes policy states 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 for the request + */ + Observable summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName); + + /** + * 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 for the request + */ + Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName); + + /** + * Summarizes policy states 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 for the request + */ + Observable summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName); + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName); + + /** + * Summarizes policy states 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 for the request + */ + Observable summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName); + + /** + * 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 for the request + */ + Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName); + + /** + * 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 for the request + */ + Observable summarizeForResourceGroupLevelPolicyAssignmentAsync(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 + */ + Completable getMetadataAsync(String scope); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesQueryResults.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesQueryResults.java new file mode 100644 index 000000000000..9c7248cbb336 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesQueryResults.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyStatesQueryResultsInner; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyStateInner; +import java.util.List; + +/** + * Type representing PolicyStatesQueryResults. + */ +public interface PolicyStatesQueryResults extends HasInner, HasManager { + /** + * @return the odatacontext value. + */ + String odatacontext(); + + /** + * @return the odatacount value. + */ + Integer odatacount(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesResource.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesResource.java new file mode 100644 index 000000000000..7bdbc62a9933 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyStatesResource.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyStatesResource. + */ +public final class PolicyStatesResource extends ExpandableStringEnum { + /** Static value default for PolicyStatesResource. */ + public static final PolicyStatesResource DEFAULT = fromString("default"); + + /** Static value latest for PolicyStatesResource. */ + public static final PolicyStatesResource LATEST = fromString("latest"); + + /** + * Creates or finds a PolicyStatesResource from its string representation. + * @param name a name to look for + * @return the corresponding PolicyStatesResource + */ + @JsonCreator + public static PolicyStatesResource fromString(String name) { + return fromString(name, PolicyStatesResource.class); + } + + /** + * @return known PolicyStatesResource values + */ + public static Collection values() { + return values(PolicyStatesResource.class); + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyTrackedResource.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyTrackedResource.java new file mode 100644 index 000000000000..39004fc330c5 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyTrackedResource.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyTrackedResourceInner; +import org.joda.time.DateTime; + +/** + * Type representing PolicyTrackedResource. + */ +public interface PolicyTrackedResource extends HasInner, HasManager { + /** + * @return the createdBy value. + */ + TrackedResourceModificationDetails createdBy(); + + /** + * @return the lastModifiedBy value. + */ + TrackedResourceModificationDetails lastModifiedBy(); + + /** + * @return the lastUpdateUtc value. + */ + DateTime lastUpdateUtc(); + + /** + * @return the policyDetails value. + */ + PolicyDetails policyDetails(); + + /** + * @return the trackedResourceId value. + */ + String trackedResourceId(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyTrackedResources.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyTrackedResources.java new file mode 100644 index 000000000000..0d1c4ca5974b --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/PolicyTrackedResources.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import rx.Observable; + +/** + * Type representing PolicyTrackedResources. + */ +public interface PolicyTrackedResources { + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listQueryResultsForManagementGroupAsync(final String managementGroupName); + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listQueryResultsForSubscriptionAsync(final String subscriptionId); + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId); + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listQueryResultsForResourceAsync(final String resourceId); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailure.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailure.java new file mode 100644 index 000000000000..11948df55ddb --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailure.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response. + */ +public class QueryFailure { + /** + * Error definition. + */ + @JsonProperty(value = "error") + private QueryFailureError error; + + /** + * Get error definition. + * + * @return the error value + */ + public QueryFailureError error() { + return this.error; + } + + /** + * Set error definition. + * + * @param error the error value to set + * @return the QueryFailure object itself. + */ + public QueryFailure withError(QueryFailureError error) { + this.error = error; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailureError.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailureError.java new file mode 100644 index 000000000000..9a77e7539e79 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailureError.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error definition. + */ +public class QueryFailureError { + /** + * Service specific error code which serves as the substatus for the HTTP + * error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Description of the error. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get service specific error code which serves as the substatus for the HTTP error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get description of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailureException.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailureException.java new file mode 100644 index 000000000000..2d787e0f8571 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryFailureException.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.v2018_07_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with QueryFailure information. + */ +public class QueryFailureException extends RestException { + /** + * Initializes a new instance of the QueryFailureException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public QueryFailureException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the QueryFailureException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public QueryFailureException(final String message, final Response response, final QueryFailure body) { + super(message, response, body); + } + + @Override + public QueryFailure body() { + return (QueryFailure) super.body(); + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryOptions.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryOptions.java new file mode 100644 index 000000000000..3e39597de692 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/QueryOptions.java @@ -0,0 +1,233 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for a set of operations. + */ +public class QueryOptions { + /** + * Maximum number of records to return. + */ + @JsonProperty(value = "") + private Integer top; + + /** + * OData filter expression. + */ + @JsonProperty(value = "") + private String filter; + + /** + * Ordering expression using OData notation. One or more comma-separated + * column names with an optional "desc" (the default) or "asc", e.g. + * "$orderby=PolicyAssignmentId, ResourceId asc". + */ + @JsonProperty(value = "") + private String orderBy; + + /** + * Select expression using OData notation. Limits the columns on each + * record to just those requested, e.g. "$select=PolicyAssignmentId, + * ResourceId". + */ + @JsonProperty(value = "") + private String select; + + /** + * ISO 8601 formatted timestamp specifying the start time of the interval + * to query. When not specified, the service uses ($to - 1-day). + */ + @JsonProperty(value = "") + private DateTime from; + + /** + * ISO 8601 formatted timestamp specifying the end time of the interval to + * query. When not specified, the service uses request time. + */ + @JsonProperty(value = "") + private DateTime to; + + /** + * OData apply expression for aggregations. + */ + @JsonProperty(value = "") + private String apply; + + /** + * The $expand query parameter. For example, to expand + * policyEvaluationDetails, use $expand=policyEvaluationDetails. + */ + @JsonProperty(value = "") + private String expand; + + /** + * Get maximum number of records to return. + * + * @return the top value + */ + public Integer top() { + return this.top; + } + + /** + * Set maximum number of records to return. + * + * @param top the top value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withTop(Integer top) { + this.top = top; + return this; + } + + /** + * Get oData filter expression. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set oData filter expression. + * + * @param filter the filter value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * + * @return the orderBy value + */ + public String orderBy() { + return this.orderBy; + } + + /** + * Set ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * + * @param orderBy the orderBy value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Get select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + * + * @param select the select value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get iSO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + * + * @return the from value + */ + public DateTime from() { + return this.from; + } + + /** + * Set iSO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + * + * @param from the from value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withFrom(DateTime from) { + this.from = from; + return this; + } + + /** + * Get iSO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + * + * @return the to value + */ + public DateTime to() { + return this.to; + } + + /** + * Set iSO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + * + * @param to the to value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withTo(DateTime to) { + this.to = to; + return this; + } + + /** + * Get oData apply expression for aggregations. + * + * @return the apply value + */ + public String apply() { + return this.apply; + } + + /** + * Set oData apply expression for aggregations. + * + * @param apply the apply value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withApply(String apply) { + this.apply = apply; + return this; + } + + /** + * Get the $expand query parameter. For example, to expand policyEvaluationDetails, use $expand=policyEvaluationDetails. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set the $expand query parameter. For example, to expand policyEvaluationDetails, use $expand=policyEvaluationDetails. + * + * @param expand the expand value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withExpand(String expand) { + this.expand = expand; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java new file mode 100644 index 000000000000..997dd5c32040 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediation.java @@ -0,0 +1,200 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.RemediationInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import org.joda.time.DateTime; + +/** + * Type representing Remediation. + */ +public interface Remediation extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the createdOn value. + */ + DateTime createdOn(); + + /** + * @return the deploymentStatus value. + */ + RemediationDeploymentSummary deploymentStatus(); + + /** + * @return the filters value. + */ + RemediationFilters filters(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastUpdatedOn value. + */ + DateTime lastUpdatedOn(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Remediation definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithMicrosoft.PolicyInsight, DefinitionStages.WithCreate { + } + + /** + * Grouping of Remediation definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Remediation definition. + */ + interface Blank extends WithMicrosoft.PolicyInsight { + } + + /** + * The stage of the remediation definition allowing to specify Microsoft.PolicyInsight. + */ + interface WithMicrosoft.PolicyInsight { + /** + * Specifies managementGroupId. + */ + WithCreate withExistingMicrosoft.PolicyInsight(String managementGroupId); + } + + /** + * The stage of the remediation definition allowing to specify DeploymentStatus. + */ + interface WithDeploymentStatus { + /** + * Specifies deploymentStatus. + */ + WithCreate withDeploymentStatus(RemediationDeploymentSummary deploymentStatus); + } + + /** + * The stage of the remediation definition allowing to specify Filters. + */ + interface WithFilters { + /** + * Specifies filters. + */ + WithCreate withFilters(RemediationFilters filters); + } + + /** + * The stage of the remediation definition allowing to specify PolicyAssignmentId. + */ + interface WithPolicyAssignmentId { + /** + * Specifies policyAssignmentId. + */ + WithCreate withPolicyAssignmentId(String policyAssignmentId); + } + + /** + * The stage of the remediation definition allowing to specify PolicyDefinitionReferenceId. + */ + interface WithPolicyDefinitionReferenceId { + /** + * Specifies policyDefinitionReferenceId. + */ + 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.WithDeploymentStatus, DefinitionStages.WithFilters, DefinitionStages.WithPolicyAssignmentId, DefinitionStages.WithPolicyDefinitionReferenceId { + } + } + /** + * The template for a Remediation update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDeploymentStatus, UpdateStages.WithFilters, UpdateStages.WithPolicyAssignmentId, UpdateStages.WithPolicyDefinitionReferenceId { + } + + /** + * Grouping of Remediation update stages. + */ + interface UpdateStages { + /** + * The stage of the remediation update allowing to specify DeploymentStatus. + */ + interface WithDeploymentStatus { + /** + * Specifies deploymentStatus. + */ + Update withDeploymentStatus(RemediationDeploymentSummary deploymentStatus); + } + + /** + * The stage of the remediation update allowing to specify Filters. + */ + interface WithFilters { + /** + * Specifies filters. + */ + Update withFilters(RemediationFilters filters); + } + + /** + * The stage of the remediation update allowing to specify PolicyAssignmentId. + */ + interface WithPolicyAssignmentId { + /** + * Specifies policyAssignmentId. + */ + Update withPolicyAssignmentId(String policyAssignmentId); + } + + /** + * The stage of the remediation update allowing to specify PolicyDefinitionReferenceId. + */ + interface WithPolicyDefinitionReferenceId { + /** + * Specifies policyDefinitionReferenceId. + */ + Update withPolicyDefinitionReferenceId(String policyDefinitionReferenceId); + } + + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationDeployment.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationDeployment.java new file mode 100644 index 000000000000..3eef477d7bc0 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationDeployment.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.RemediationDeploymentInner; +import org.joda.time.DateTime; + +/** + * Type representing RemediationDeployment. + */ +public interface RemediationDeployment extends HasInner, HasManager { + /** + * @return the createdOn value. + */ + DateTime createdOn(); + + /** + * @return the deploymentId value. + */ + String deploymentId(); + + /** + * @return the error value. + */ + ErrorDefinition error(); + + /** + * @return the lastUpdatedOn value. + */ + DateTime lastUpdatedOn(); + + /** + * @return the remediatedResourceId value. + */ + String remediatedResourceId(); + + /** + * @return the resourceLocation value. + */ + String resourceLocation(); + + /** + * @return the status value. + */ + String status(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationDeploymentSummary.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationDeploymentSummary.java new file mode 100644 index 000000000000..312a06fc97da --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationDeploymentSummary.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The deployment status summary for all deployments created by the + * remediation. + */ +public class RemediationDeploymentSummary { + /** + * The number of deployments required by the remediation. + */ + @JsonProperty(value = "totalDeployments") + private Integer totalDeployments; + + /** + * The number of deployments required by the remediation that have + * succeeded. + */ + @JsonProperty(value = "successfulDeployments") + private Integer successfulDeployments; + + /** + * The number of deployments required by the remediation that have failed. + */ + @JsonProperty(value = "failedDeployments") + private Integer failedDeployments; + + /** + * Get the number of deployments required by the remediation. + * + * @return the totalDeployments value + */ + public Integer totalDeployments() { + return this.totalDeployments; + } + + /** + * Set the number of deployments required by the remediation. + * + * @param totalDeployments the totalDeployments value to set + * @return the RemediationDeploymentSummary object itself. + */ + public RemediationDeploymentSummary withTotalDeployments(Integer totalDeployments) { + this.totalDeployments = totalDeployments; + return this; + } + + /** + * Get the number of deployments required by the remediation that have succeeded. + * + * @return the successfulDeployments value + */ + public Integer successfulDeployments() { + return this.successfulDeployments; + } + + /** + * Set the number of deployments required by the remediation that have succeeded. + * + * @param successfulDeployments the successfulDeployments value to set + * @return the RemediationDeploymentSummary object itself. + */ + public RemediationDeploymentSummary withSuccessfulDeployments(Integer successfulDeployments) { + this.successfulDeployments = successfulDeployments; + return this; + } + + /** + * Get the number of deployments required by the remediation that have failed. + * + * @return the failedDeployments value + */ + public Integer failedDeployments() { + return this.failedDeployments; + } + + /** + * Set the number of deployments required by the remediation that have failed. + * + * @param failedDeployments the failedDeployments value to set + * @return the RemediationDeploymentSummary object itself. + */ + public RemediationDeploymentSummary withFailedDeployments(Integer failedDeployments) { + this.failedDeployments = failedDeployments; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationFilters.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationFilters.java new file mode 100644 index 000000000000..da87866d3c57 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/RemediationFilters.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.v2018_07_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The filters that will be applied to determine which resources to remediate. + */ +public class RemediationFilters { + /** + * The resource locations that will be remediated. + */ + @JsonProperty(value = "locations") + private List locations; + + /** + * Get the resource locations that will be remediated. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set the resource locations that will be remediated. + * + * @param locations the locations value to set + * @return the RemediationFilters object itself. + */ + public RemediationFilters withLocations(List locations) { + this.locations = locations; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediations.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediations.java new file mode 100644 index 000000000000..a9d391b8ed75 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Remediations.java @@ -0,0 +1,257 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.RemediationInner; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.RemediationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Remediations. + */ +public interface Remediations extends SupportsCreating, HasInner { + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName); + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable cancelAtManagementGroupAsync(String managementGroupId, String remediationName); + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForManagementGroupAsync(final String managementGroupId); + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupAsync(String managementGroupId, String remediationName); + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAtManagementGroupAsync(String managementGroupId, String remediationName); + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName); + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable cancelAtSubscriptionAsync(String subscriptionId, String remediationName); + + /** + * Creates or updates a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtSubscriptionAsync(String subscriptionId, String remediationName, RemediationInner parameters); + + /** + * Gets an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtSubscriptionAsync(String subscriptionId, String remediationName); + + /** + * Deletes an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAtSubscriptionAsync(String subscriptionId, String remediationName); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName); + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable cancelAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName); + + /** + * Creates or updates a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName, RemediationInner parameters); + + /** + * Gets an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName); + + /** + * Deletes an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName); + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listDeploymentsAtResourceAsync(final String resourceId, final String remediationName); + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable cancelAtResourceAsync(String resourceId, String remediationName); + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtResourceAsync(String resourceId, String remediationName, RemediationInner parameters); + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtResourceAsync(String resourceId, String remediationName); + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAtResourceAsync(String resourceId, String remediationName); + + /** + * Gets all remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String subscriptionId); + + /** + * Gets all remediations for the subscription. + * + * @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 + */ + Observable listByResourceGroupAsync(final String subscriptionId, final String resourceGroupName); + + /** + * Gets all remediations 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/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/SummarizeResults.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/SummarizeResults.java new file mode 100644 index 000000000000..6da00a268fa7 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/SummarizeResults.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.PolicyInsightsManager; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation.SummarizeResultsInner; +import java.util.List; + +/** + * Type representing SummarizeResults. + */ +public interface SummarizeResults extends HasInner, HasManager { + /** + * @return the odatacontext value. + */ + String odatacontext(); + + /** + * @return the odatacount value. + */ + Integer odatacount(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Summary.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Summary.java new file mode 100644 index 000000000000..0dc79e25b729 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/Summary.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Summary results. + */ +public class Summary { + /** + * OData entity ID; always set to null since summaries do not have an + * entity ID. + */ + @JsonProperty(value = "@odata\\.id") + private String odataid; + + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * Non-compliance summary for all policy assignments. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /** + * Policy assignments summary. + */ + @JsonProperty(value = "policyAssignments") + private List policyAssignments; + + /** + * Get oData entity ID; always set to null since summaries do not have an entity ID. + * + * @return the odataid value + */ + public String odataid() { + return this.odataid; + } + + /** + * Set oData entity ID; always set to null since summaries do not have an entity ID. + * + * @param odataid the odataid value to set + * @return the Summary object itself. + */ + public Summary withOdataid(String odataid) { + this.odataid = odataid; + return this; + } + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the Summary object itself. + */ + public Summary withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get non-compliance summary for all policy assignments. + * + * @return the results value + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set non-compliance summary for all policy assignments. + * + * @param results the results value to set + * @return the Summary object itself. + */ + public Summary withResults(SummaryResults results) { + this.results = results; + return this; + } + + /** + * Get policy assignments summary. + * + * @return the policyAssignments value + */ + public List policyAssignments() { + return this.policyAssignments; + } + + /** + * Set policy assignments summary. + * + * @param policyAssignments the policyAssignments value to set + * @return the Summary object itself. + */ + public Summary withPolicyAssignments(List policyAssignments) { + this.policyAssignments = policyAssignments; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/SummaryResults.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/SummaryResults.java new file mode 100644 index 000000000000..dd6f856d9d74 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/SummaryResults.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Non-compliance summary on a particular summary level. + */ +public class SummaryResults { + /** + * HTTP POST URI for queryResults action on Microsoft.PolicyInsights to + * retrieve raw results for the non-compliance summary. + */ + @JsonProperty(value = "queryResultsUri") + private String queryResultsUri; + + /** + * Number of non-compliant resources. + */ + @JsonProperty(value = "nonCompliantResources") + private Integer nonCompliantResources; + + /** + * Number of non-compliant policies. + */ + @JsonProperty(value = "nonCompliantPolicies") + private Integer nonCompliantPolicies; + + /** + * Get hTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the non-compliance summary. + * + * @return the queryResultsUri value + */ + public String queryResultsUri() { + return this.queryResultsUri; + } + + /** + * Set hTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the non-compliance summary. + * + * @param queryResultsUri the queryResultsUri value to set + * @return the SummaryResults object itself. + */ + public SummaryResults withQueryResultsUri(String queryResultsUri) { + this.queryResultsUri = queryResultsUri; + return this; + } + + /** + * Get number of non-compliant resources. + * + * @return the nonCompliantResources value + */ + public Integer nonCompliantResources() { + return this.nonCompliantResources; + } + + /** + * Set number of non-compliant resources. + * + * @param nonCompliantResources the nonCompliantResources value to set + * @return the SummaryResults object itself. + */ + public SummaryResults withNonCompliantResources(Integer nonCompliantResources) { + this.nonCompliantResources = nonCompliantResources; + return this; + } + + /** + * Get number of non-compliant policies. + * + * @return the nonCompliantPolicies value + */ + public Integer nonCompliantPolicies() { + return this.nonCompliantPolicies; + } + + /** + * Set number of non-compliant policies. + * + * @param nonCompliantPolicies the nonCompliantPolicies value to set + * @return the SummaryResults object itself. + */ + public SummaryResults withNonCompliantPolicies(Integer nonCompliantPolicies) { + this.nonCompliantPolicies = nonCompliantPolicies; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/TrackedResourceModificationDetails.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/TrackedResourceModificationDetails.java new file mode 100644 index 000000000000..da1bda28414b --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/TrackedResourceModificationDetails.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the policy triggered deployment that created or modified the + * tracked resource. + */ +public class TrackedResourceModificationDetails { + /** + * The details of the policy that created or modified the tracked resource. + */ + @JsonProperty(value = "policyDetails", access = JsonProperty.Access.WRITE_ONLY) + private PolicyDetails policyDetails; + + /** + * The ID of the deployment that created or modified the tracked resource. + */ + @JsonProperty(value = "deploymentId", access = JsonProperty.Access.WRITE_ONLY) + private String deploymentId; + + /** + * Timestamp of the deployment that created or modified the tracked + * resource. + */ + @JsonProperty(value = "deploymentTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime deploymentTime; + + /** + * Get the details of the policy that created or modified the tracked resource. + * + * @return the policyDetails value + */ + public PolicyDetails policyDetails() { + return this.policyDetails; + } + + /** + * Get the ID of the deployment that created or modified the tracked resource. + * + * @return the deploymentId value + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Get timestamp of the deployment that created or modified the tracked resource. + * + * @return the deploymentTime value + */ + public DateTime deploymentTime() { + return this.deploymentTime; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/TypedErrorInfo.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/TypedErrorInfo.java new file mode 100644 index 000000000000..1eb1c1dfb2f8 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/TypedErrorInfo.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.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Scenario specific error details. + */ +public class TypedErrorInfo { + /** + * The type of included error details. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The scenario specific error details. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type of included error details. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the scenario specific error details. + * + * @return the info value + */ + public Object info() { + return this.info; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/IdParsingUtils.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..d0e60aa96109 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..53e38f4bd9a3 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation definition. + */ +public class OperationInner { + /** + * Operation name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get display metadata associated with the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set display metadata associated with the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..7633d7fe11cc --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsImpl.java @@ -0,0 +1,42 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.OperationsListResults; + +class OperationsImpl extends WrapperImpl implements Operations { + private final PolicyInsightsManager manager; + + OperationsImpl(PolicyInsightsManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .map(new Func1() { + @Override + public OperationsListResults call(OperationsListResultsInner inner) { + return new OperationsListResultsImpl(inner, manager()); + } + }); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..7473be30a39d --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsInner.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryFailureException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Operations list" }) + @GET("providers/Microsoft.PolicyInsights/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists available operations. + * + * @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 OperationsListResultsInner object if successful. + */ + public OperationsListResultsInner list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists available operations. + * + * @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 ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists available operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationsListResultsInner object + */ + public Observable listAsync() { + return listWithServiceResponseAsync().map(new Func1, OperationsListResultsInner>() { + @Override + public OperationsListResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists available operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationsListResultsInner object + */ + public Observable> listWithServiceResponseAsync() { + final String apiVersion = "2018-07-01-preview"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws QueryFailureException, IOException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(QueryFailureException.class) + .build(response); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsListResultsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsListResultsImpl.java new file mode 100644 index 000000000000..a92ae4b5f285 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsListResultsImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.OperationsListResults; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class OperationsListResultsImpl extends WrapperImpl implements OperationsListResults { + private final PolicyInsightsManager manager; + OperationsListResultsImpl(OperationsListResultsInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Integer odatacount() { + return this.inner().odatacount(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsListResultsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsListResultsInner.java new file mode 100644 index 000000000000..bc14cf0e0d9a --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/OperationsListResultsInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * List of available operations. + */ +public class OperationsListResultsInner { + /** + * OData entity count; represents the number of operations returned. + */ + @JsonProperty(value = "@odata\\.count") + private Integer odatacount; + + /** + * List of available operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get oData entity count; represents the number of operations returned. + * + * @return the odatacount value + */ + public Integer odatacount() { + return this.odatacount; + } + + /** + * Set oData entity count; represents the number of operations returned. + * + * @param odatacount the odatacount value to set + * @return the OperationsListResultsInner object itself. + */ + public OperationsListResultsInner withOdatacount(Integer odatacount) { + this.odatacount = odatacount; + return this; + } + + /** + * Get list of available operations. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of available operations. + * + * @param value the value value to set + * @return the OperationsListResultsInner object itself. + */ + public OperationsListResultsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..0e697d9da105 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("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 PageImpl 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 PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventInner.java new file mode 100644 index 000000000000..83582712bde9 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventInner.java @@ -0,0 +1,809 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy event record. + */ +public class PolicyEventInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * OData entity ID; always set to null since policy event records do not + * have an entity ID. + */ + @JsonProperty(value = "@odata\\.id") + private String odataid; + + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * Timestamp for the policy event record. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Resource ID. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /** + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /** + * Effective parameters for the policy assignment. + */ + @JsonProperty(value = "effectiveParameters") + private String effectiveParameters; + + /** + * Flag which states whether the resource is compliant against the policy + * assignment it was evaluated against. + */ + @JsonProperty(value = "isCompliant") + private Boolean isCompliant; + + /** + * Subscription ID. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * Resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * Resource location. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /** + * Resource group name. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * List of resource tags. + */ + @JsonProperty(value = "resourceTags") + private String resourceTags; + + /** + * Policy assignment name. + */ + @JsonProperty(value = "policyAssignmentName") + private String policyAssignmentName; + + /** + * Policy assignment owner. + */ + @JsonProperty(value = "policyAssignmentOwner") + private String policyAssignmentOwner; + + /** + * Policy assignment parameters. + */ + @JsonProperty(value = "policyAssignmentParameters") + private String policyAssignmentParameters; + + /** + * Policy assignment scope. + */ + @JsonProperty(value = "policyAssignmentScope") + private String policyAssignmentScope; + + /** + * Policy definition name. + */ + @JsonProperty(value = "policyDefinitionName") + private String policyDefinitionName; + + /** + * Policy definition action, i.e. effect. + */ + @JsonProperty(value = "policyDefinitionAction") + private String policyDefinitionAction; + + /** + * Policy definition category. + */ + @JsonProperty(value = "policyDefinitionCategory") + private String policyDefinitionCategory; + + /** + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /** + * Policy set definition name, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionName") + private String policySetDefinitionName; + + /** + * Policy set definition owner, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionOwner") + private String policySetDefinitionOwner; + + /** + * Policy set definition category, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionCategory") + private String policySetDefinitionCategory; + + /** + * Policy set definition parameters, if the policy assignment is for a + * policy set. + */ + @JsonProperty(value = "policySetDefinitionParameters") + private String policySetDefinitionParameters; + + /** + * Comma separated list of management group IDs, which represent the + * hierarchy of the management groups the resource is under. + */ + @JsonProperty(value = "managementGroupIds") + private String managementGroupIds; + + /** + * Reference ID for the policy definition inside the policy set, if the + * policy assignment is for a policy set. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * Tenant ID for the policy event record. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Principal object ID for the user who initiated the resource operation + * that triggered the policy event. + */ + @JsonProperty(value = "principalOid") + private String principalOid; + + /** + * 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 PolicyEventInner object itself. + */ + public PolicyEventInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get oData entity ID; always set to null since policy event records do not have an entity ID. + * + * @return the odataid value + */ + public String odataid() { + return this.odataid; + } + + /** + * Set oData entity ID; always set to null since policy event records do not have an entity ID. + * + * @param odataid the odataid value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withOdataid(String odataid) { + this.odataid = odataid; + return this; + } + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get timestamp for the policy event record. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set timestamp for the policy event record. + * + * @param timestamp the timestamp value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get resource ID. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set resource ID. + * + * @param resourceId the resourceId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get policy assignment ID. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get policy definition ID. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get effective parameters for the policy assignment. + * + * @return the effectiveParameters value + */ + public String effectiveParameters() { + return this.effectiveParameters; + } + + /** + * Set effective parameters for the policy assignment. + * + * @param effectiveParameters the effectiveParameters value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withEffectiveParameters(String effectiveParameters) { + this.effectiveParameters = effectiveParameters; + return this; + } + + /** + * Get flag which states whether the resource is compliant against the policy assignment it was evaluated against. + * + * @return the isCompliant value + */ + public Boolean isCompliant() { + return this.isCompliant; + } + + /** + * Set flag which states whether the resource is compliant against the policy assignment it was evaluated against. + * + * @param isCompliant the isCompliant value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withIsCompliant(Boolean isCompliant) { + this.isCompliant = isCompliant; + return this; + } + + /** + * Get subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set subscription ID. + * + * @param subscriptionId the subscriptionId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set resource type. + * + * @param resourceType the resourceType value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get resource location. + * + * @return the resourceLocation value + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set resource location. + * + * @param resourceLocation the resourceLocation value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get resource group name. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set resource group name. + * + * @param resourceGroup the resourceGroup value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get list of resource tags. + * + * @return the resourceTags value + */ + public String resourceTags() { + return this.resourceTags; + } + + /** + * Set list of resource tags. + * + * @param resourceTags the resourceTags value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceTags(String resourceTags) { + this.resourceTags = resourceTags; + return this; + } + + /** + * Get policy assignment name. + * + * @return the policyAssignmentName value + */ + public String policyAssignmentName() { + return this.policyAssignmentName; + } + + /** + * Set policy assignment name. + * + * @param policyAssignmentName the policyAssignmentName value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentName(String policyAssignmentName) { + this.policyAssignmentName = policyAssignmentName; + return this; + } + + /** + * Get policy assignment owner. + * + * @return the policyAssignmentOwner value + */ + public String policyAssignmentOwner() { + return this.policyAssignmentOwner; + } + + /** + * Set policy assignment owner. + * + * @param policyAssignmentOwner the policyAssignmentOwner value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentOwner(String policyAssignmentOwner) { + this.policyAssignmentOwner = policyAssignmentOwner; + return this; + } + + /** + * Get policy assignment parameters. + * + * @return the policyAssignmentParameters value + */ + public String policyAssignmentParameters() { + return this.policyAssignmentParameters; + } + + /** + * Set policy assignment parameters. + * + * @param policyAssignmentParameters the policyAssignmentParameters value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentParameters(String policyAssignmentParameters) { + this.policyAssignmentParameters = policyAssignmentParameters; + return this; + } + + /** + * Get policy assignment scope. + * + * @return the policyAssignmentScope value + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Set policy assignment scope. + * + * @param policyAssignmentScope the policyAssignmentScope value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentScope(String policyAssignmentScope) { + this.policyAssignmentScope = policyAssignmentScope; + return this; + } + + /** + * Get policy definition name. + * + * @return the policyDefinitionName value + */ + public String policyDefinitionName() { + return this.policyDefinitionName; + } + + /** + * Set policy definition name. + * + * @param policyDefinitionName the policyDefinitionName value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionName(String policyDefinitionName) { + this.policyDefinitionName = policyDefinitionName; + 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 PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionAction(String policyDefinitionAction) { + this.policyDefinitionAction = policyDefinitionAction; + return this; + } + + /** + * Get policy definition category. + * + * @return the policyDefinitionCategory value + */ + public String policyDefinitionCategory() { + return this.policyDefinitionCategory; + } + + /** + * Set policy definition category. + * + * @param policyDefinitionCategory the policyDefinitionCategory value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionCategory(String policyDefinitionCategory) { + this.policyDefinitionCategory = policyDefinitionCategory; + return this; + } + + /** + * Get policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get policy set definition name, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionName value + */ + public String policySetDefinitionName() { + return this.policySetDefinitionName; + } + + /** + * Set policy set definition name, if the policy assignment is for a policy set. + * + * @param policySetDefinitionName the policySetDefinitionName value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionName(String policySetDefinitionName) { + this.policySetDefinitionName = policySetDefinitionName; + return this; + } + + /** + * Get policy set definition owner, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionOwner value + */ + public String policySetDefinitionOwner() { + return this.policySetDefinitionOwner; + } + + /** + * Set policy set definition owner, if the policy assignment is for a policy set. + * + * @param policySetDefinitionOwner the policySetDefinitionOwner value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionOwner(String policySetDefinitionOwner) { + this.policySetDefinitionOwner = policySetDefinitionOwner; + return this; + } + + /** + * Get policy set definition category, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionCategory value + */ + public String policySetDefinitionCategory() { + return this.policySetDefinitionCategory; + } + + /** + * Set policy set definition category, if the policy assignment is for a policy set. + * + * @param policySetDefinitionCategory the policySetDefinitionCategory value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionCategory(String policySetDefinitionCategory) { + this.policySetDefinitionCategory = policySetDefinitionCategory; + return this; + } + + /** + * Get policy set definition parameters, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionParameters value + */ + public String policySetDefinitionParameters() { + return this.policySetDefinitionParameters; + } + + /** + * Set policy set definition parameters, if the policy assignment is for a policy set. + * + * @param policySetDefinitionParameters the policySetDefinitionParameters value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionParameters(String policySetDefinitionParameters) { + this.policySetDefinitionParameters = policySetDefinitionParameters; + return this; + } + + /** + * Get comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + * + * @return the managementGroupIds value + */ + public String managementGroupIds() { + return this.managementGroupIds; + } + + /** + * Set comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + * + * @param managementGroupIds the managementGroupIds value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withManagementGroupIds(String managementGroupIds) { + this.managementGroupIds = managementGroupIds; + return this; + } + + /** + * Get reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + 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 PolicyEventInner object itself. + */ + public PolicyEventInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get principal object ID for the user who initiated the resource 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 operation that triggered the policy event. + * + * @param principalOid the principalOid value to set + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPrincipalOid(String principalOid) { + this.principalOid = principalOid; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java new file mode 100644 index 000000000000..0dfd86230aa0 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsImpl.java @@ -0,0 +1,133 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEventsQueryResults; + +class PolicyEventsImpl extends WrapperImpl implements PolicyEvents { + private final PolicyInsightsManager manager; + + PolicyEventsImpl(PolicyInsightsManager manager) { + super(manager.inner().policyEvents()); + this.manager = manager; + } + + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Observable listQueryResultsForManagementGroupAsync(String managementGroupName) { + PolicyEventsInner client = this.inner(); + return client.listQueryResultsForManagementGroupAsync(managementGroupName) + .map(new Func1() { + @Override + public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { + return new PolicyEventsQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForSubscriptionAsync(String subscriptionId) { + PolicyEventsInner client = this.inner(); + return client.listQueryResultsForSubscriptionAsync(subscriptionId) + .map(new Func1() { + @Override + public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { + return new PolicyEventsQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) { + PolicyEventsInner client = this.inner(); + return client.listQueryResultsForResourceGroupAsync(subscriptionId, resourceGroupName) + .map(new Func1() { + @Override + public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { + return new PolicyEventsQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForResourceAsync(String resourceId) { + PolicyEventsInner client = this.inner(); + return client.listQueryResultsForResourceAsync(resourceId) + .map(new Func1() { + @Override + public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { + return new PolicyEventsQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { + PolicyEventsInner client = this.inner(); + return client.listQueryResultsForPolicySetDefinitionAsync(subscriptionId, policySetDefinitionName) + .map(new Func1() { + @Override + public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { + return new PolicyEventsQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { + PolicyEventsInner client = this.inner(); + return client.listQueryResultsForPolicyDefinitionAsync(subscriptionId, policyDefinitionName) + .map(new Func1() { + @Override + public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { + return new PolicyEventsQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { + PolicyEventsInner client = this.inner(); + return client.listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(subscriptionId, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { + return new PolicyEventsQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + PolicyEventsInner client = this.inner(); + return client.listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(subscriptionId, resourceGroupName, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyEventsQueryResults call(PolicyEventsQueryResultsInner inner) { + return new PolicyEventsQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Completable getMetadataAsync(String scope) { + PolicyEventsInner client = this.inner(); + return client.getMetadataAsync(scope).toCompletable(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java new file mode 100644 index 000000000000..fa9b428e4eff --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsInner.java @@ -0,0 +1,1736 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryFailureException; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryOptions; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyEvents. + */ +public class PolicyEventsInner { + /** The Retrofit service to perform REST calls. */ + private PolicyEventsService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyEventsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyEventsInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(PolicyEventsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyEvents to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyEventsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + Observable> listQueryResultsForManagementGroup(@Path("policyEventsResource") String policyEventsResource, @Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + Observable> listQueryResultsForSubscription(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + Observable> listQueryResultsForResourceGroup(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + Observable> listQueryResultsForResource(@Path("policyEventsResource") String policyEventsResource, @Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForPolicySetDefinition" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + Observable> listQueryResultsForPolicySetDefinition(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policySetDefinitionName") String policySetDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForPolicyDefinition" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + Observable> listQueryResultsForPolicyDefinition(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForSubscriptionLevelPolicyAssignment" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + Observable> listQueryResultsForSubscriptionLevelPolicyAssignment(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents listQueryResultsForResourceGroupLevelPolicyAssignment" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + Observable> listQueryResultsForResourceGroupLevelPolicyAssignment(@Path("policyEventsResource") String policyEventsResource, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents getMetadata" }) + @GET("{scope}/providers/Microsoft.PolicyInsights/policyEvents/$metadata") + Observable> getMetadata(@Path(value = "scope", encoded = true) String scope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management 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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management 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 listQueryResultsForManagementGroupAsync(String managementGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName), serviceCallback); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner object + */ + public Observable listQueryResultsForManagementGroupAsync(String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(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 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.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, 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 = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group 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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName, QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group 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 listQueryResultsForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the resources under the management group. + * + * @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 + */ + public Observable listQueryResultsForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the management group. + * + * @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 + */ + public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(String managementGroupName, 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"; + 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.listQueryResultsForManagementGroup(policyEventsResource, managementGroupsNamespace, managementGroupName, 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 = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForManagementGroupDelegate(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 events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 listQueryResultsForSubscriptionAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable listQueryResultsForSubscriptionAsync(String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(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 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.listQueryResultsForSubscription(policyEventsResource, subscriptionId, 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 = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 listQueryResultsForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @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 + */ + public Observable listQueryResultsForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @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 + */ + public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(String subscriptionId, 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"; + 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.listQueryResultsForSubscription(policyEventsResource, subscriptionId, 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 = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForSubscriptionDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName), 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(String subscriptionId, 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 policyEventsResource = "default"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, 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 = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + 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(); + } + }); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, 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 policyEventsResource = "default"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroup(policyEventsResource, subscriptionId, resourceGroupName, 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 = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceGroupDelegate(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 events for the resource. + * + * @param resourceId Resource ID. + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId).toBlocking().single().body(); + } + + /** + * Queries policy events for the 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 listQueryResultsForResourceAsync(String resourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(resourceId), serviceCallback); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner object + */ + public Observable listQueryResultsForResourceAsync(String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId).map(new Func1, PolicyEventsQueryResultsInner>() { + @Override + public PolicyEventsQueryResultsInner 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceWithServiceResponseAsync(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 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.listQueryResultsForResource(policyEventsResource, resourceId, 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 = listQueryResultsForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId, QueryOptions queryOptions) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the 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 listQueryResultsForResourceAsync(String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * Queries policy events for the 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceWithServiceResponseAsync(String resourceId, 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"; + 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.listQueryResultsForResource(policyEventsResource, resourceId, 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 = listQueryResultsForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForPolicySetDefinition(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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(policyEventsResource, 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); + } + } + }); + } + + private ServiceResponse listQueryResultsForPolicySetDefinitionDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName), serviceCallback); + } + + /** + * 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + 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(); + } + }); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName, 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."); + } + Validator.validate(queryOptions); + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.listQueryResultsForPolicyDefinition(policyEventsResource, subscriptionId, authorizationNamespace, policyDefinitionName, 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 = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForPolicyDefinitionDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName), serviceCallback); + } + + /** + * 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions), serviceCallback); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + 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(); + } + }); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName, 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."); + } + Validator.validate(queryOptions); + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.listQueryResultsForSubscriptionLevelPolicyAssignment(policyEventsResource, subscriptionId, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(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 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 + * @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. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().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. + * @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(String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName), serviceCallback); + } + + /** + * 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 PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(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 policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 PolicyEventsQueryResultsInner object if successful. + */ + public PolicyEventsQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single().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. + * @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(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), serviceCallback); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyEventsQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(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 policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-04-04"; + 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.listQueryResultsForResourceGroupLevelPolicyAssignment(policyEventsResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(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); + } + + /** + * 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 + * @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. + */ + public String getMetadata(String scope) { + return getMetadataWithServiceResponseAsync(scope).toBlocking().single().body(); + } + + /** + * 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. + * @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); + } + + /** + * 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 to the String object + */ + public Observable getMetadataAsync(String scope) { + return getMetadataWithServiceResponseAsync(scope).map(new Func1, String>() { + @Override + public String call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 to the String object + */ + public Observable> getMetadataWithServiceResponseAsync(String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + final String apiVersion = "2018-04-04"; + return service.getMetadata(scope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMetadataDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMetadataDelegate(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); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsQueryResultsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsQueryResultsImpl.java new file mode 100644 index 000000000000..e5c16dd81a5b --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsQueryResultsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEventsQueryResults; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class PolicyEventsQueryResultsImpl extends WrapperImpl implements PolicyEventsQueryResults { + private final PolicyInsightsManager manager; + PolicyEventsQueryResultsImpl(PolicyEventsQueryResultsInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public String odatacontext() { + return this.inner().odatacontext(); + } + + @Override + public Integer odatacount() { + return this.inner().odatacount(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsQueryResultsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsQueryResultsInner.java new file mode 100644 index 000000000000..582541002203 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyEventsQueryResultsInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Query results. + */ +public class PolicyEventsQueryResultsInner { + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * OData entity count; represents the number of policy event records + * returned. + */ + @JsonProperty(value = "@odata\\.count") + private Integer odatacount; + + /** + * Query results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the PolicyEventsQueryResultsInner object itself. + */ + public PolicyEventsQueryResultsInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get oData entity count; represents the number of policy event records returned. + * + * @return the odatacount value + */ + public Integer odatacount() { + return this.odatacount; + } + + /** + * Set oData entity count; represents the number of policy event records returned. + * + * @param odatacount the odatacount value to set + * @return the PolicyEventsQueryResultsInner object itself. + */ + public PolicyEventsQueryResultsInner withOdatacount(Integer odatacount) { + this.odatacount = odatacount; + return this; + } + + /** + * Get query results. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set query results. + * + * @param value the value value to set + * @return the PolicyEventsQueryResultsInner object itself. + */ + public PolicyEventsQueryResultsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java new file mode 100644 index 000000000000..99e42cb64ee3 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsClientImpl.java @@ -0,0 +1,216 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the PolicyInsightsClientImpl class. + */ +public class PolicyInsightsClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public PolicyInsightsClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public PolicyInsightsClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public PolicyInsightsClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The PolicyTrackedResourcesInner object to access its operations. + */ + private PolicyTrackedResourcesInner policyTrackedResources; + + /** + * Gets the PolicyTrackedResourcesInner object to access its operations. + * @return the PolicyTrackedResourcesInner object. + */ + public PolicyTrackedResourcesInner policyTrackedResources() { + return this.policyTrackedResources; + } + + /** + * The RemediationsInner object to access its operations. + */ + private RemediationsInner remediations; + + /** + * Gets the RemediationsInner object to access its operations. + * @return the RemediationsInner object. + */ + public RemediationsInner remediations() { + return this.remediations; + } + + /** + * The PolicyEventsInner object to access its operations. + */ + private PolicyEventsInner policyEvents; + + /** + * Gets the PolicyEventsInner object to access its operations. + * @return the PolicyEventsInner object. + */ + public PolicyEventsInner policyEvents() { + return this.policyEvents; + } + + /** + * The PolicyStatesInner object to access its operations. + */ + private PolicyStatesInner policyStates; + + /** + * Gets the PolicyStatesInner object to access its operations. + * @return the PolicyStatesInner object. + */ + public PolicyStatesInner policyStates() { + return this.policyStates; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of PolicyInsightsClient client. + * + * @param credentials the management credentials for Azure + */ + public PolicyInsightsClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of PolicyInsightsClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public PolicyInsightsClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of PolicyInsightsClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public PolicyInsightsClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.policyTrackedResources = new PolicyTrackedResourcesInner(restClient().retrofit(), this); + this.remediations = new RemediationsInner(restClient().retrofit(), this); + this.policyEvents = new PolicyEventsInner(restClient().retrofit(), this); + this.policyStates = new PolicyStatesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s)", super.userAgent(), "PolicyInsightsClient"); + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsManager.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsManager.java new file mode 100644 index 000000000000..cdbd5b37c21a --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyInsightsManager.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResources; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvents; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Operations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure PolicyInsights resource management. + */ +public final class PolicyInsightsManager extends ManagerCore { + private PolicyTrackedResources policyTrackedResources; + private Remediations remediations; + private PolicyEvents policyEvents; + private PolicyStates policyStates; + private Operations operations; + /** + * Get a Configurable instance that can be used to create PolicyInsightsManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new PolicyInsightsManager.ConfigurableImpl(); + } + /** + * Creates an instance of PolicyInsightsManager that exposes PolicyInsights resource management API entry points. + * + * @param credentials the credentials to use + * @return the PolicyInsightsManager + */ + public static PolicyInsightsManager authenticate(AzureTokenCredentials credentials) { + return new PolicyInsightsManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of PolicyInsightsManager that exposes PolicyInsights resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the PolicyInsightsManager + */ + public static PolicyInsightsManager authenticate(RestClient restClient) { + return new PolicyInsightsManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of PolicyInsightsManager that exposes PolicyInsights management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing PolicyInsights management API entry points that work across subscriptions + */ + PolicyInsightsManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @return Entry point to manage PolicyTrackedResources. + */ + public PolicyTrackedResources policyTrackedResources() { + if (this.policyTrackedResources == null) { + this.policyTrackedResources = new PolicyTrackedResourcesImpl(this); + } + return this.policyTrackedResources; + } + + /** + * @return Entry point to manage Remediations. + */ + public Remediations remediations() { + if (this.remediations == null) { + this.remediations = new RemediationsImpl(this); + } + return this.remediations; + } + + /** + * @return Entry point to manage PolicyEvents. + */ + public PolicyEvents policyEvents() { + if (this.policyEvents == null) { + this.policyEvents = new PolicyEventsImpl(this); + } + return this.policyEvents; + } + + /** + * @return Entry point to manage PolicyStates. + */ + public PolicyStates policyStates() { + if (this.policyStates == null) { + this.policyStates = new PolicyStatesImpl(this); + } + return this.policyStates; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public PolicyInsightsManager authenticate(AzureTokenCredentials credentials) { + return PolicyInsightsManager.authenticate(buildRestClient(credentials)); + } + } + private PolicyInsightsManager(RestClient restClient) { + super( + restClient, + null, + new PolicyInsightsClientImpl(restClient)); + } +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateInner.java new file mode 100644 index 000000000000..face05b5eb27 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStateInner.java @@ -0,0 +1,809 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyEvaluationDetails; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy state record. + */ +public class PolicyStateInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * OData entity ID; always set to null since policy state records do not + * have an entity ID. + */ + @JsonProperty(value = "@odata\\.id") + private String odataid; + + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * Timestamp for the policy state record. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Resource ID. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /** + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /** + * Effective parameters for the policy assignment. + */ + @JsonProperty(value = "effectiveParameters") + private String effectiveParameters; + + /** + * Flag which states whether the resource is compliant against the policy + * assignment it was evaluated against. + */ + @JsonProperty(value = "isCompliant") + private Boolean isCompliant; + + /** + * Subscription ID. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * Resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * Resource location. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /** + * Resource group name. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * List of resource tags. + */ + @JsonProperty(value = "resourceTags") + private String resourceTags; + + /** + * Policy assignment name. + */ + @JsonProperty(value = "policyAssignmentName") + private String policyAssignmentName; + + /** + * Policy assignment owner. + */ + @JsonProperty(value = "policyAssignmentOwner") + private String policyAssignmentOwner; + + /** + * Policy assignment parameters. + */ + @JsonProperty(value = "policyAssignmentParameters") + private String policyAssignmentParameters; + + /** + * Policy assignment scope. + */ + @JsonProperty(value = "policyAssignmentScope") + private String policyAssignmentScope; + + /** + * Policy definition name. + */ + @JsonProperty(value = "policyDefinitionName") + private String policyDefinitionName; + + /** + * Policy definition action, i.e. effect. + */ + @JsonProperty(value = "policyDefinitionAction") + private String policyDefinitionAction; + + /** + * Policy definition category. + */ + @JsonProperty(value = "policyDefinitionCategory") + private String policyDefinitionCategory; + + /** + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /** + * Policy set definition name, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionName") + private String policySetDefinitionName; + + /** + * Policy set definition owner, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionOwner") + private String policySetDefinitionOwner; + + /** + * Policy set definition category, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionCategory") + private String policySetDefinitionCategory; + + /** + * Policy set definition parameters, if the policy assignment is for a + * policy set. + */ + @JsonProperty(value = "policySetDefinitionParameters") + private String policySetDefinitionParameters; + + /** + * Comma separated list of management group IDs, which represent the + * hierarchy of the management groups the resource is under. + */ + @JsonProperty(value = "managementGroupIds") + private String managementGroupIds; + + /** + * Reference ID for the policy definition inside the policy set, if the + * policy assignment is for a policy set. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * Compliance state of the resource. + */ + @JsonProperty(value = "complianceState") + private String complianceState; + + /** + * Policy evaluation details. + */ + @JsonProperty(value = "policyEvaluationDetails") + private PolicyEvaluationDetails policyEvaluationDetails; + + /** + * 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 PolicyStateInner object itself. + */ + public PolicyStateInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get oData entity ID; always set to null since policy state records do not have an entity ID. + * + * @return the odataid value + */ + public String odataid() { + return this.odataid; + } + + /** + * Set oData entity ID; always set to null since policy state records do not have an entity ID. + * + * @param odataid the odataid value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withOdataid(String odataid) { + this.odataid = odataid; + return this; + } + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get timestamp for the policy state record. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set timestamp for the policy state record. + * + * @param timestamp the timestamp value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get resource ID. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set resource ID. + * + * @param resourceId the resourceId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get policy assignment ID. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get policy definition ID. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get effective parameters for the policy assignment. + * + * @return the effectiveParameters value + */ + public String effectiveParameters() { + return this.effectiveParameters; + } + + /** + * Set effective parameters for the policy assignment. + * + * @param effectiveParameters the effectiveParameters value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withEffectiveParameters(String effectiveParameters) { + this.effectiveParameters = effectiveParameters; + return this; + } + + /** + * Get flag which states whether the resource is compliant against the policy assignment it was evaluated against. + * + * @return the isCompliant value + */ + public Boolean isCompliant() { + return this.isCompliant; + } + + /** + * Set flag which states whether the resource is compliant against the policy assignment it was evaluated against. + * + * @param isCompliant the isCompliant value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withIsCompliant(Boolean isCompliant) { + this.isCompliant = isCompliant; + return this; + } + + /** + * Get subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set subscription ID. + * + * @param subscriptionId the subscriptionId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set resource type. + * + * @param resourceType the resourceType value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get resource location. + * + * @return the resourceLocation value + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set resource location. + * + * @param resourceLocation the resourceLocation value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get resource group name. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set resource group name. + * + * @param resourceGroup the resourceGroup value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get list of resource tags. + * + * @return the resourceTags value + */ + public String resourceTags() { + return this.resourceTags; + } + + /** + * Set list of resource tags. + * + * @param resourceTags the resourceTags value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceTags(String resourceTags) { + this.resourceTags = resourceTags; + return this; + } + + /** + * Get policy assignment name. + * + * @return the policyAssignmentName value + */ + public String policyAssignmentName() { + return this.policyAssignmentName; + } + + /** + * Set policy assignment name. + * + * @param policyAssignmentName the policyAssignmentName value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentName(String policyAssignmentName) { + this.policyAssignmentName = policyAssignmentName; + return this; + } + + /** + * Get policy assignment owner. + * + * @return the policyAssignmentOwner value + */ + public String policyAssignmentOwner() { + return this.policyAssignmentOwner; + } + + /** + * Set policy assignment owner. + * + * @param policyAssignmentOwner the policyAssignmentOwner value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentOwner(String policyAssignmentOwner) { + this.policyAssignmentOwner = policyAssignmentOwner; + return this; + } + + /** + * Get policy assignment parameters. + * + * @return the policyAssignmentParameters value + */ + public String policyAssignmentParameters() { + return this.policyAssignmentParameters; + } + + /** + * Set policy assignment parameters. + * + * @param policyAssignmentParameters the policyAssignmentParameters value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentParameters(String policyAssignmentParameters) { + this.policyAssignmentParameters = policyAssignmentParameters; + return this; + } + + /** + * Get policy assignment scope. + * + * @return the policyAssignmentScope value + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Set policy assignment scope. + * + * @param policyAssignmentScope the policyAssignmentScope value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentScope(String policyAssignmentScope) { + this.policyAssignmentScope = policyAssignmentScope; + return this; + } + + /** + * Get policy definition name. + * + * @return the policyDefinitionName value + */ + public String policyDefinitionName() { + return this.policyDefinitionName; + } + + /** + * Set policy definition name. + * + * @param policyDefinitionName the policyDefinitionName value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionName(String policyDefinitionName) { + this.policyDefinitionName = policyDefinitionName; + 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 PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionAction(String policyDefinitionAction) { + this.policyDefinitionAction = policyDefinitionAction; + return this; + } + + /** + * Get policy definition category. + * + * @return the policyDefinitionCategory value + */ + public String policyDefinitionCategory() { + return this.policyDefinitionCategory; + } + + /** + * Set policy definition category. + * + * @param policyDefinitionCategory the policyDefinitionCategory value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionCategory(String policyDefinitionCategory) { + this.policyDefinitionCategory = policyDefinitionCategory; + return this; + } + + /** + * Get policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get policy set definition name, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionName value + */ + public String policySetDefinitionName() { + return this.policySetDefinitionName; + } + + /** + * Set policy set definition name, if the policy assignment is for a policy set. + * + * @param policySetDefinitionName the policySetDefinitionName value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionName(String policySetDefinitionName) { + this.policySetDefinitionName = policySetDefinitionName; + return this; + } + + /** + * Get policy set definition owner, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionOwner value + */ + public String policySetDefinitionOwner() { + return this.policySetDefinitionOwner; + } + + /** + * Set policy set definition owner, if the policy assignment is for a policy set. + * + * @param policySetDefinitionOwner the policySetDefinitionOwner value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionOwner(String policySetDefinitionOwner) { + this.policySetDefinitionOwner = policySetDefinitionOwner; + return this; + } + + /** + * Get policy set definition category, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionCategory value + */ + public String policySetDefinitionCategory() { + return this.policySetDefinitionCategory; + } + + /** + * Set policy set definition category, if the policy assignment is for a policy set. + * + * @param policySetDefinitionCategory the policySetDefinitionCategory value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionCategory(String policySetDefinitionCategory) { + this.policySetDefinitionCategory = policySetDefinitionCategory; + return this; + } + + /** + * Get policy set definition parameters, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionParameters value + */ + public String policySetDefinitionParameters() { + return this.policySetDefinitionParameters; + } + + /** + * Set policy set definition parameters, if the policy assignment is for a policy set. + * + * @param policySetDefinitionParameters the policySetDefinitionParameters value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionParameters(String policySetDefinitionParameters) { + this.policySetDefinitionParameters = policySetDefinitionParameters; + return this; + } + + /** + * Get comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + * + * @return the managementGroupIds value + */ + public String managementGroupIds() { + return this.managementGroupIds; + } + + /** + * Set comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + * + * @param managementGroupIds the managementGroupIds value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withManagementGroupIds(String managementGroupIds) { + this.managementGroupIds = managementGroupIds; + return this; + } + + /** + * Get reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + 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 PolicyStateInner object itself. + */ + public PolicyStateInner withComplianceState(String complianceState) { + this.complianceState = complianceState; + return this; + } + + /** + * Get policy evaluation details. + * + * @return the policyEvaluationDetails value + */ + public PolicyEvaluationDetails policyEvaluationDetails() { + return this.policyEvaluationDetails; + } + + /** + * Set policy evaluation details. + * + * @param policyEvaluationDetails the policyEvaluationDetails value to set + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyEvaluationDetails(PolicyEvaluationDetails policyEvaluationDetails) { + this.policyEvaluationDetails = policyEvaluationDetails; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java new file mode 100644 index 000000000000..de8ec1f82078 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesImpl.java @@ -0,0 +1,231 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesQueryResults; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.SummarizeResults; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesResource; + +class PolicyStatesImpl extends WrapperImpl implements PolicyStates { + private final PolicyInsightsManager manager; + + PolicyStatesImpl(PolicyInsightsManager manager) { + super(manager.inner().policyStates()); + this.manager = manager; + } + + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Observable listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName) { + PolicyStatesInner client = this.inner(); + return client.listQueryResultsForManagementGroupAsync(policyStatesResource, managementGroupName) + .map(new Func1() { + @Override + public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { + return new PolicyStatesQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable summarizeForManagementGroupAsync(String managementGroupName) { + PolicyStatesInner client = this.inner(); + return client.summarizeForManagementGroupAsync(managementGroupName) + .map(new Func1() { + @Override + public SummarizeResults call(SummarizeResultsInner inner) { + return new SummarizeResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId) { + PolicyStatesInner client = this.inner(); + return client.listQueryResultsForSubscriptionAsync(policyStatesResource, subscriptionId) + .map(new Func1() { + @Override + public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { + return new PolicyStatesQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable summarizeForSubscriptionAsync(String subscriptionId) { + PolicyStatesInner client = this.inner(); + return client.summarizeForSubscriptionAsync(subscriptionId) + .map(new Func1() { + @Override + public SummarizeResults call(SummarizeResultsInner inner) { + return new SummarizeResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + PolicyStatesInner client = this.inner(); + return client.listQueryResultsForResourceGroupAsync(policyStatesResource, subscriptionId, resourceGroupName) + .map(new Func1() { + @Override + public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { + return new PolicyStatesQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName) { + PolicyStatesInner client = this.inner(); + return client.summarizeForResourceGroupAsync(subscriptionId, resourceGroupName) + .map(new Func1() { + @Override + public SummarizeResults call(SummarizeResultsInner inner) { + return new SummarizeResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId) { + PolicyStatesInner client = this.inner(); + return client.listQueryResultsForResourceAsync(policyStatesResource, resourceId) + .map(new Func1() { + @Override + public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { + return new PolicyStatesQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable summarizeForResourceAsync(String resourceId) { + PolicyStatesInner client = this.inner(); + return client.summarizeForResourceAsync(resourceId) + .map(new Func1() { + @Override + public SummarizeResults call(SummarizeResultsInner inner) { + return new SummarizeResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + PolicyStatesInner client = this.inner(); + return client.listQueryResultsForPolicySetDefinitionAsync(policyStatesResource, subscriptionId, policySetDefinitionName) + .map(new Func1() { + @Override + public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { + return new PolicyStatesQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { + PolicyStatesInner client = this.inner(); + return client.summarizeForPolicySetDefinitionAsync(subscriptionId, policySetDefinitionName) + .map(new Func1() { + @Override + public SummarizeResults call(SummarizeResultsInner inner) { + return new SummarizeResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + PolicyStatesInner client = this.inner(); + return client.listQueryResultsForPolicyDefinitionAsync(policyStatesResource, subscriptionId, policyDefinitionName) + .map(new Func1() { + @Override + public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { + return new PolicyStatesQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { + PolicyStatesInner client = this.inner(); + return client.summarizeForPolicyDefinitionAsync(subscriptionId, policyDefinitionName) + .map(new Func1() { + @Override + public SummarizeResults call(SummarizeResultsInner inner) { + return new SummarizeResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + PolicyStatesInner client = this.inner(); + return client.listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(policyStatesResource, subscriptionId, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { + return new PolicyStatesQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { + PolicyStatesInner client = this.inner(); + return client.summarizeForSubscriptionLevelPolicyAssignmentAsync(subscriptionId, policyAssignmentName) + .map(new Func1() { + @Override + public SummarizeResults call(SummarizeResultsInner inner) { + return new SummarizeResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { + PolicyStatesInner client = this.inner(); + return client.listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyStatesQueryResults call(PolicyStatesQueryResultsInner inner) { + return new PolicyStatesQueryResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { + PolicyStatesInner client = this.inner(); + return client.summarizeForResourceGroupLevelPolicyAssignmentAsync(subscriptionId, resourceGroupName, policyAssignmentName) + .map(new Func1() { + @Override + public SummarizeResults call(SummarizeResultsInner inner) { + return new SummarizeResultsImpl(inner, manager()); + } + }); + } + + @Override + public Completable getMetadataAsync(String scope) { + PolicyStatesInner client = this.inner(); + return client.getMetadataAsync(scope).toCompletable(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java new file mode 100644 index 000000000000..f52804758294 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesInner.java @@ -0,0 +1,3316 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesResource; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryFailureException; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryOptions; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyStates. + */ +public class PolicyStatesInner { + /** The Retrofit service to perform REST calls. */ + private PolicyStatesService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyStatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyStatesInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(PolicyStatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyStates to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyStatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates listQueryResultsForManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + Observable> listQueryResultsForManagementGroup(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates summarizeForManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForManagementGroup(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @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.v2018_07_01_preview.PolicyStates listQueryResultsForSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + Observable> listQueryResultsForSubscription(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates summarizeForSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForSubscription(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @Path("subscriptionId") String subscriptionId, @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.v2018_07_01_preview.PolicyStates listQueryResultsForResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + Observable> listQueryResultsForResourceGroup(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates summarizeForResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForResourceGroup(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @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.v2018_07_01_preview.PolicyStates listQueryResultsForResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + Observable> listQueryResultsForResource(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$expand") String expand, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates summarizeForResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + 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.v2018_07_01_preview.PolicyStates listQueryResultsForPolicySetDefinition" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + Observable> listQueryResultsForPolicySetDefinition(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policySetDefinitionName") String policySetDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates summarizeForPolicySetDefinition" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForPolicySetDefinition(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @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("$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.v2018_07_01_preview.PolicyStates listQueryResultsForPolicyDefinition" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + Observable> listQueryResultsForPolicyDefinition(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates summarizeForPolicyDefinition" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForPolicyDefinition(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @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("$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.v2018_07_01_preview.PolicyStates listQueryResultsForSubscriptionLevelPolicyAssignment" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + Observable> listQueryResultsForSubscriptionLevelPolicyAssignment(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates summarizeForSubscriptionLevelPolicyAssignment" }) + @POST("subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + Observable> summarizeForSubscriptionLevelPolicyAssignment(@Path("policyStatesSummaryResource") String policyStatesSummaryResource, @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("$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.v2018_07_01_preview.PolicyStates listQueryResultsForResourceGroupLevelPolicyAssignment" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + Observable> listQueryResultsForResourceGroupLevelPolicyAssignment(@Path("policyStatesResource") PolicyStatesResource policyStatesResource1, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("authorizationNamespace") String authorizationNamespace, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Query("$orderby") String orderBy, @Query("$select") String select, @Query("$from") DateTime from, @Query("$to") DateTime to, @Query("$filter") String filter, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStates summarizeForResourceGroupLevelPolicyAssignment" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + 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.v2018_07_01_preview.PolicyStates getMetadata" }) + @GET("{scope}/providers/Microsoft.PolicyInsights/policyStates/$metadata") + Observable> getMetadata(@Path(value = "scope", encoded = true) String scope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 + * @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 listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).toBlocking().single().body(); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param managementGroupName Management group name. + * @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 listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName), 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (managementGroupName == null) { + throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + 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.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, 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 = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param managementGroupName Management group name. + * @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 listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName, queryOptions), 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForManagementGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String managementGroupName, QueryOptions queryOptions) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (managementGroupName == null) { + throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + 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.listQueryResultsForManagementGroup(policyStatesResource, managementGroupsNamespace, managementGroupName, 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 = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForManagementGroupDelegate(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); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management 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 summarizeForManagementGroup(String managementGroupName) { + return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management 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 summarizeForManagementGroupAsync(String managementGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForManagementGroupWithServiceResponseAsync(managementGroupName), serviceCallback); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SummarizeResultsInner object + */ + public Observable summarizeForManagementGroupAsync(String managementGroupName) { + return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SummarizeResultsInner object + */ + public Observable> summarizeForManagementGroupWithServiceResponseAsync(String managementGroupName) { + if (managementGroupName == null) { + throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group 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 summarizeForManagementGroup(String managementGroupName, QueryOptions queryOptions) { + return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group 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 summarizeForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @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 SummarizeResultsInner object + */ + public Observable summarizeForManagementGroupAsync(String managementGroupName, QueryOptions queryOptions) { + return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForManagementGroupWithServiceResponseAsync(String managementGroupName, QueryOptions queryOptions) { + if (managementGroupName == null) { + throw new IllegalArgumentException("Parameter managementGroupName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.summarizeForManagementGroup(policyStatesSummaryResource, managementGroupsNamespace, managementGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForManagementGroupDelegate(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 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 + * @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 listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId).toBlocking().single().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. + * @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 listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId), serviceCallback); + } + + /** + * 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + 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.listQueryResultsForSubscription(policyStatesResource, subscriptionId, 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 = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions).toBlocking().single().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. + * @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 listQueryResultsForSubscriptionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId, queryOptions), serviceCallback); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, 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."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + 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.listQueryResultsForSubscription(policyStatesResource, subscriptionId, 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 = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForSubscriptionDelegate(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); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscription(String subscriptionId) { + return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 summarizeForSubscriptionAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForSubscriptionAsync(String subscriptionId) { + return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForSubscriptionWithServiceResponseAsync(String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscription(String subscriptionId, QueryOptions queryOptions) { + return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 summarizeForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @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 SummarizeResultsInner object + */ + public Observable summarizeForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) { + return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForSubscriptionWithServiceResponseAsync(String subscriptionId, QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.summarizeForSubscription(policyStatesSummaryResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForSubscriptionDelegate(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 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 + * @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 listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName).toBlocking().single().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. + * @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 listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName), serviceCallback); + } + + /** + * 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + 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."); + } + final String apiVersion = "2018-07-01-preview"; + 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.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, 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 = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).toBlocking().single().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. + * @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 listQueryResultsForResourceGroupAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions), serviceCallback); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, 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."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + 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.listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName, 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 = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceGroupDelegate(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); + } + + /** + * Summarizes policy states 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 + * @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 summarizeForResourceGroup(String subscriptionId, String resourceGroupName) { + return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName) { + return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForResourceGroupWithServiceResponseAsync(String subscriptionId, 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 policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 summarizeForResourceGroup(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 SummarizeResultsInner object + */ + public Observable summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName, QueryOptions queryOptions) { + return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, 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 policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-07-01-preview"; + 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.summarizeForResourceGroup(policyStatesSummaryResource, subscriptionId, resourceGroupName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForResourceGroupDelegate(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. + * + * @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 + * @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 listQueryResultsForResource(PolicyStatesResource policyStatesResource, String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId).toBlocking().single().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. + * @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 listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId), serviceCallback); + } + + /** + * 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + 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 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForResource(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { + return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions).toBlocking().single().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. + * @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 listQueryResultsForResourceAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions), serviceCallback); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { + if (policyStatesResource == null) { + throw new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null."); + } + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + 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 expand = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceDelegate(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); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @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 summarizeForResource(String resourceId) { + return summarizeForResourceWithServiceResponseAsync(resourceId).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the 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 summarizeForResourceAsync(String resourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceWithServiceResponseAsync(resourceId), serviceCallback); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SummarizeResultsInner object + */ + public Observable summarizeForResourceAsync(String resourceId) { + return summarizeForResourceWithServiceResponseAsync(resourceId).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SummarizeResultsInner object + */ + public Observable> summarizeForResourceWithServiceResponseAsync(String resourceId) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForResource(policyStatesSummaryResource, resourceId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @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 summarizeForResource(String resourceId, QueryOptions queryOptions) { + return summarizeForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the 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 summarizeForResourceAsync(String resourceId, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForResourceWithServiceResponseAsync(resourceId, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the 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 SummarizeResultsInner object + */ + public Observable summarizeForResourceAsync(String resourceId, QueryOptions queryOptions) { + return summarizeForResourceWithServiceResponseAsync(resourceId, queryOptions).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states for the 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 SummarizeResultsInner object + */ + public Observable> summarizeForResourceWithServiceResponseAsync(String resourceId, QueryOptions queryOptions) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.summarizeForResource(policyStatesSummaryResource, resourceId, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse summarizeForResourceDelegate(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 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 + * @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(); + } + + /** + * 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. + * @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); + } + + /** + * 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 + */ + public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName).map(new Func1, PolicyStatesQueryResultsInner>() { + @Override + public PolicyStatesQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + */ + public Observable> listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, 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 (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + 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); + } + } + }); + } + + /** + * 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. + * @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(); + } + + /** + * 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. + * @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); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable listQueryResultsForPolicySetDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policySetDefinitionName, queryOptions).map(new Func1, PolicyStatesQueryResultsInner>() { + @Override + public PolicyStatesQueryResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + 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."); + } + 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 = "2018-07-01-preview"; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForPolicySetDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForPolicySetDefinitionDelegate(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); + } + + /** + * Summarizes policy states 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 + * @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(); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @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 summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName) { + return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForPolicySetDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policySetDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .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); + } + } + }); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @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 SummarizeResultsInner object if successful. + */ + public SummarizeResultsInner summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @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 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 set definition. + * + * @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 SummarizeResultsInner object + */ + 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(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @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 SummarizeResultsInner object + */ + public Observable> summarizeForPolicySetDefinitionWithServiceResponseAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForPolicySetDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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) + .build(response); + } + + /** + * 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 + * @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 listQueryResultsForPolicyDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName).toBlocking().single().body(); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @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); + } + + /** + * 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 + */ + 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(); + } + }); + } + + /** + * 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 + */ + public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, 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 (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForPolicyDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @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); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForPolicyDefinitionWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, 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."); + } + Validator.validate(queryOptions); + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + 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.listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, authorizationNamespace, policyDefinitionName, 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 = listQueryResultsForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForPolicyDefinitionDelegate(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); + } + + /** + * Summarizes policy states 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 + * @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(); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName) { + return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForPolicyDefinition(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyDefinitionName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 SummarizeResultsInner object if successful. + */ + public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { + return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 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 definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 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(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName, 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."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.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 = summarizeForPolicyDefinitionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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) + .build(response); + } + + /** + * 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 + * @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 listQueryResultsForSubscriptionLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @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); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, 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 (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String orderBy = null; + String select = null; + DateTime from = null; + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @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 listQueryResultsForSubscriptionLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @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); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, 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."); + } + Validator.validate(queryOptions); + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + 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.listQueryResultsForSubscriptionLevelPolicyAssignment(policyStatesResource, subscriptionId, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForSubscriptionLevelPolicyAssignmentDelegate(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); + } + + /** + * Summarizes policy states 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 + * @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(); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName), serviceCallback); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { + return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1, SummarizeResultsInner>() { + @Override + public SummarizeResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Summarizes policy states 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 SummarizeResultsInner object + */ + public Observable> summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForSubscriptionLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = summarizeForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { + return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions), serviceCallback); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 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(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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> summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(String subscriptionId, String policyAssignmentName, 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."); + } + Validator.validate(queryOptions); + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + 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.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 = summarizeForSubscriptionLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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 PolicyStatesQueryResultsInner object if successful. + */ + public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { + return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName).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(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName), 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner 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."); + } + 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 = "2018-07-01-preview"; + 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.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } 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 PolicyStatesQueryResultsInner 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(); + } + + /** + * 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(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions), 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 PolicyStatesQueryResultsInner 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(); + } + }); + } + + /** + * 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 PolicyStatesQueryResultsInner object + */ + public Observable> listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, 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 = "2018-07-01-preview"; + 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.listQueryResultsForResourceGroupLevelPolicyAssignment(policyStatesResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, 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 = listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listQueryResultsForResourceGroupLevelPolicyAssignmentDelegate(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); + } + + /** + * 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 = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + DateTime from = null; + DateTime to = null; + String filter = null; + return service.summarizeForResourceGroupLevelPolicyAssignment(policyStatesSummaryResource, subscriptionId, resourceGroupName, authorizationNamespace, policyAssignmentName, apiVersion, this.client.acceptLanguage(), top, from, to, filter, this.client.userAgent()) + .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 = "2018-07-01-preview"; + 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); + } + + /** + * 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 + * @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. + */ + public String getMetadata(String scope) { + return getMetadataWithServiceResponseAsync(scope).toBlocking().single().body(); + } + + /** + * 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. + * @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); + } + + /** + * 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 to the String object + */ + public Observable getMetadataAsync(String scope) { + return getMetadataWithServiceResponseAsync(scope).map(new Func1, String>() { + @Override + public String call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 to the String object + */ + public Observable> getMetadataWithServiceResponseAsync(String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.getMetadata(scope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMetadataDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMetadataDelegate(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); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsImpl.java new file mode 100644 index 000000000000..aa6ffc9640ba --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyStatesQueryResults; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class PolicyStatesQueryResultsImpl extends WrapperImpl implements PolicyStatesQueryResults { + private final PolicyInsightsManager manager; + PolicyStatesQueryResultsImpl(PolicyStatesQueryResultsInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public String odatacontext() { + return this.inner().odatacontext(); + } + + @Override + public Integer odatacount() { + return this.inner().odatacount(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsInner.java new file mode 100644 index 000000000000..10193a88fb1d --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyStatesQueryResultsInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Query results. + */ +public class PolicyStatesQueryResultsInner { + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * OData entity count; represents the number of policy state records + * returned. + */ + @JsonProperty(value = "@odata\\.count") + private Integer odatacount; + + /** + * Query results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the PolicyStatesQueryResultsInner object itself. + */ + public PolicyStatesQueryResultsInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get oData entity count; represents the number of policy state records returned. + * + * @return the odatacount value + */ + public Integer odatacount() { + return this.odatacount; + } + + /** + * Set oData entity count; represents the number of policy state records returned. + * + * @param odatacount the odatacount value to set + * @return the PolicyStatesQueryResultsInner object itself. + */ + public PolicyStatesQueryResultsInner withOdatacount(Integer odatacount) { + this.odatacount = odatacount; + return this; + } + + /** + * Get query results. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set query results. + * + * @param value the value value to set + * @return the PolicyStatesQueryResultsInner object itself. + */ + public PolicyStatesQueryResultsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourceImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourceImpl.java new file mode 100644 index 000000000000..8463fedae212 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourceImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResource; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.TrackedResourceModificationDetails; +import org.joda.time.DateTime; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyDetails; + +class PolicyTrackedResourceImpl extends WrapperImpl implements PolicyTrackedResource { + private final PolicyInsightsManager manager; + PolicyTrackedResourceImpl(PolicyTrackedResourceInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public TrackedResourceModificationDetails createdBy() { + return this.inner().createdBy(); + } + + @Override + public TrackedResourceModificationDetails lastModifiedBy() { + return this.inner().lastModifiedBy(); + } + + @Override + public DateTime lastUpdateUtc() { + return this.inner().lastUpdateUtc(); + } + + @Override + public PolicyDetails policyDetails() { + return this.inner().policyDetails(); + } + + @Override + public String trackedResourceId() { + return this.inner().trackedResourceId(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourceInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourceInner.java new file mode 100644 index 000000000000..6309e469fded --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourceInner.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyDetails; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.TrackedResourceModificationDetails; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy tracked resource record. + */ +public class PolicyTrackedResourceInner { + /** + * The ID of the policy tracked resource. + */ + @JsonProperty(value = "trackedResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String trackedResourceId; + + /** + * The details of the policy that require the tracked resource. + */ + @JsonProperty(value = "policyDetails", access = JsonProperty.Access.WRITE_ONLY) + private PolicyDetails policyDetails; + + /** + * The details of the policy triggered deployment that created the tracked + * resource. + */ + @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY) + private TrackedResourceModificationDetails createdBy; + + /** + * The details of the policy triggered deployment that modified the tracked + * resource. + */ + @JsonProperty(value = "lastModifiedBy", access = JsonProperty.Access.WRITE_ONLY) + private TrackedResourceModificationDetails lastModifiedBy; + + /** + * Timestamp of the last update to the tracked resource. + */ + @JsonProperty(value = "lastUpdateUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdateUtc; + + /** + * Get the ID of the policy tracked resource. + * + * @return the trackedResourceId value + */ + public String trackedResourceId() { + return this.trackedResourceId; + } + + /** + * Get the details of the policy that require the tracked resource. + * + * @return the policyDetails value + */ + public PolicyDetails policyDetails() { + return this.policyDetails; + } + + /** + * Get the details of the policy triggered deployment that created the tracked resource. + * + * @return the createdBy value + */ + public TrackedResourceModificationDetails createdBy() { + return this.createdBy; + } + + /** + * Get the details of the policy triggered deployment that modified the tracked resource. + * + * @return the lastModifiedBy value + */ + public TrackedResourceModificationDetails lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get timestamp of the last update to the tracked resource. + * + * @return the lastUpdateUtc value + */ + public DateTime lastUpdateUtc() { + return this.lastUpdateUtc; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesImpl.java new file mode 100644 index 000000000000..224511852432 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesImpl.java @@ -0,0 +1,103 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResources; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResource; + +class PolicyTrackedResourcesImpl extends WrapperImpl implements PolicyTrackedResources { + private final PolicyInsightsManager manager; + + PolicyTrackedResourcesImpl(PolicyInsightsManager manager) { + super(manager.inner().policyTrackedResources()); + this.manager = manager; + } + + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Observable listQueryResultsForManagementGroupAsync(final String managementGroupName) { + PolicyTrackedResourcesInner client = this.inner(); + return client.listQueryResultsForManagementGroupAsync(managementGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyTrackedResource call(PolicyTrackedResourceInner inner) { + return new PolicyTrackedResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForSubscriptionAsync(final String subscriptionId) { + PolicyTrackedResourcesInner client = this.inner(); + return client.listQueryResultsForSubscriptionAsync(subscriptionId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyTrackedResource call(PolicyTrackedResourceInner inner) { + return new PolicyTrackedResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId) { + PolicyTrackedResourcesInner client = this.inner(); + return client.listQueryResultsForResourceGroupAsync(resourceGroupName, subscriptionId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyTrackedResource call(PolicyTrackedResourceInner inner) { + return new PolicyTrackedResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listQueryResultsForResourceAsync(final String resourceId) { + PolicyTrackedResourcesInner client = this.inner(); + return client.listQueryResultsForResourceAsync(resourceId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyTrackedResource call(PolicyTrackedResourceInner inner) { + return new PolicyTrackedResourceImpl(inner, manager()); + } + }); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java new file mode 100644 index 000000000000..fa1354dda179 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesInner.java @@ -0,0 +1,1486 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryFailureException; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryOptions; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.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.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; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyTrackedResources. + */ +public class PolicyTrackedResourcesInner { + /** The Retrofit service to perform REST calls. */ + private PolicyTrackedResourcesService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyTrackedResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyTrackedResourcesInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(PolicyTrackedResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyTrackedResources to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyTrackedResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResources listQueryResultsForManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + Observable> listQueryResultsForManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupName") String managementGroupName, @Path("policyTrackedResourcesResource") String policyTrackedResourcesResource, @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.v2018_07_01_preview.PolicyTrackedResources listQueryResultsForSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + Observable> listQueryResultsForSubscription(@Path("policyTrackedResourcesResource") String policyTrackedResourcesResource, @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.v2018_07_01_preview.PolicyTrackedResources listQueryResultsForResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + Observable> listQueryResultsForResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("policyTrackedResourcesResource") String policyTrackedResourcesResource, @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.v2018_07_01_preview.PolicyTrackedResources listQueryResultsForResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + Observable> listQueryResultsForResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("policyTrackedResourcesResource") String policyTrackedResourcesResource, @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.v2018_07_01_preview.PolicyTrackedResources listQueryResultsForManagementGroupNext" }) + @GET + Observable> listQueryResultsForManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResources listQueryResultsForSubscriptionNext" }) + @GET + Observable> listQueryResultsForSubscriptionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResources listQueryResultsForResourceGroupNext" }) + @GET + Observable> listQueryResultsForResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResources listQueryResultsForResourceNext" }) + @GET + Observable> listQueryResultsForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management 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 PagedList<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management 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> listQueryResultsForManagementGroupAsync(final String managementGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForManagementGroupSinglePageAsync(managementGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForManagementGroupAsync(final String managementGroupName) { + return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable>> listQueryResultsForManagementGroupWithServiceResponseAsync(final String managementGroupName) { + return listQueryResultsForManagementGroupSinglePageAsync(managementGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyTrackedResourceInner> 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 managementGroupsNamespace = "Microsoft.Management"; + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group 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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group 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> 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); + } + + /** + * Queries policy tracked resources under the management group. + * + * @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 PagedList<PolicyTrackedResourceInner> object + */ + 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(); + } + }); + } + + /** + * Queries policy tracked resources under the management group. + * + * @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 PagedList<PolicyTrackedResourceInner> object + */ + public Observable>> 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 tracked 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<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + 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 managementGroupsNamespace = "Microsoft.Management"; + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listQueryResultsForManagementGroup(managementGroupsNamespace, managementGroupName, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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> listQueryResultsForSubscriptionAsync(final String subscriptionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForSubscriptionSinglePageAsync(subscriptionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForSubscriptionAsync(final String subscriptionId) { + return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> 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)); + } + }); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForSubscriptionSinglePageAsync(final String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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> 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); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @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 PagedList<PolicyTrackedResourceInner> object + */ + 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(); + } + }); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @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 PagedList<PolicyTrackedResourceInner> object + */ + 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 tracked 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<PolicyTrackedResourceInner> 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 policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listQueryResultsForSubscription(policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroup(final String resourceGroupName, final String subscriptionId) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, subscriptionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription 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> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, subscriptionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(resourceGroupName, subscriptionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable>> listQueryResultsForResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String subscriptionId) { + return listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, 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(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final String resourceGroupName, final String subscriptionId) { + 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."); + } + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + public PagedList listQueryResultsForResourceGroup(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions) { + ServiceResponse> response = listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, subscriptionId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param subscriptionId Microsoft Azure subscription 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> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, subscriptionId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @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 PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupWithServiceResponseAsync(resourceGroupName, subscriptionId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @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 PagedList<PolicyTrackedResourceInner> object + */ + public Observable>> listQueryResultsForResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions) { + return listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, 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(listQueryResultsForResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy tracked resources under the resource group. + * + ServiceResponse> * @param resourceGroupName Resource group name. + 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<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceGroupSinglePageAsync(final String resourceGroupName, final String subscriptionId, final QueryOptions queryOptions) { + 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."); + } + Validator.validate(queryOptions); + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource, subscriptionId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the 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> listQueryResultsForResourceAsync(final String resourceId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listQueryResultsForResourceSinglePageAsync(resourceId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listQueryResultsForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> object + */ + public Observable> listQueryResultsForResourceAsync(final String resourceId) { + return listQueryResultsForResourceWithServiceResponseAsync(resourceId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyTrackedResourceInner> 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)); + } + }); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceSinglePageAsync(final String resourceId) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @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<PolicyTrackedResourceInner> object if successful. + */ + 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(); + } + }; + } + + /** + * Queries policy tracked resources under the 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> 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); + } + + /** + * Queries policy tracked resources under the 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<PolicyTrackedResourceInner> object + */ + 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(); + } + }); + } + + /** + * Queries policy tracked resources under the 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<PolicyTrackedResourceInner> object + */ + public Observable>> listQueryResultsForResourceWithServiceResponseAsync(final String resourceId, final QueryOptions queryOptions) { + return listQueryResultsForResourceSinglePageAsync(resourceId, queryOptions) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listQueryResultsForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Queries policy tracked resources under 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<PolicyTrackedResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listQueryResultsForResourceSinglePageAsync(final String resourceId, final QueryOptions queryOptions) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listQueryResultsForResource(resourceId, policyTrackedResourcesResource, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listQueryResultsForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + + /** + * Queries policy tracked 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<PolicyTrackedResourceInner> 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 tracked 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked 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<PolicyTrackedResourceInner> 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 tracked resources under 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<PolicyTrackedResourceInner> 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 tracked resources under 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 tracked resources under 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<PolicyTrackedResourceInner> 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 tracked resources under 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<PolicyTrackedResourceInner> 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 tracked resources under 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<PolicyTrackedResourceInner> 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); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationDeploymentImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationDeploymentImpl.java new file mode 100644 index 000000000000..f4d1d78cf05b --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationDeploymentImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.RemediationDeployment; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.ErrorDefinition; + +class RemediationDeploymentImpl extends WrapperImpl implements RemediationDeployment { + private final PolicyInsightsManager manager; + RemediationDeploymentImpl(RemediationDeploymentInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public DateTime createdOn() { + return this.inner().createdOn(); + } + + @Override + public String deploymentId() { + return this.inner().deploymentId(); + } + + @Override + public ErrorDefinition error() { + return this.inner().error(); + } + + @Override + public DateTime lastUpdatedOn() { + return this.inner().lastUpdatedOn(); + } + + @Override + public String remediatedResourceId() { + return this.inner().remediatedResourceId(); + } + + @Override + public String resourceLocation() { + return this.inner().resourceLocation(); + } + + @Override + public String status() { + return this.inner().status(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationDeploymentInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationDeploymentInner.java new file mode 100644 index 000000000000..fb36eb857e62 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationDeploymentInner.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.ErrorDefinition; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of a single deployment created by the remediation. + */ +public class RemediationDeploymentInner { + /** + * Resource ID of the resource that is being remediated by the deployment. + */ + @JsonProperty(value = "remediatedResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String remediatedResourceId; + + /** + * Resource ID of the template deployment that will remediate the resource. + */ + @JsonProperty(value = "deploymentId", access = JsonProperty.Access.WRITE_ONLY) + private String deploymentId; + + /** + * Status of the remediation deployment. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Location of the resource that is being remediated. + */ + @JsonProperty(value = "resourceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String resourceLocation; + + /** + * Error encountered while remediated the resource. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ErrorDefinition error; + + /** + * The time at which the remediation was created. + */ + @JsonProperty(value = "createdOn", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdOn; + + /** + * The time at which the remediation deployment was last updated. + */ + @JsonProperty(value = "lastUpdatedOn", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedOn; + + /** + * Get resource ID of the resource that is being remediated by the deployment. + * + * @return the remediatedResourceId value + */ + public String remediatedResourceId() { + return this.remediatedResourceId; + } + + /** + * Get resource ID of the template deployment that will remediate the resource. + * + * @return the deploymentId value + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Get status of the remediation deployment. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get location of the resource that is being remediated. + * + * @return the resourceLocation value + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Get error encountered while remediated the resource. + * + * @return the error value + */ + public ErrorDefinition error() { + return this.error; + } + + /** + * Get the time at which the remediation was created. + * + * @return the createdOn value + */ + public DateTime createdOn() { + return this.createdOn; + } + + /** + * Get the time at which the remediation deployment was last updated. + * + * @return the lastUpdatedOn value + */ + public DateTime lastUpdatedOn() { + return this.lastUpdatedOn; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationImpl.java new file mode 100644 index 000000000000..90cb77725cb8 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationImpl.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediation; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.RemediationFilters; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.RemediationDeploymentSummary; + +class RemediationImpl extends CreatableUpdatableImpl implements Remediation, Remediation.Definition, Remediation.Update { + private final PolicyInsightsManager manager; + private String managementGroupId; + private String remediationName; + + RemediationImpl(String name, PolicyInsightsManager manager) { + super(name, new RemediationInner()); + this.manager = manager; + // Set resource name + this.remediationName = name; + // + } + + RemediationImpl(RemediationInner inner, PolicyInsightsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.remediationName = inner.name(); + // resource ancestor names + this.managementGroupId = IdParsingUtils.getValueFromIdByName(inner.id(), "managementGroups"); + this.remediationName = IdParsingUtils.getValueFromIdByName(inner.id(), "remediations"); + // + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + RemediationsInner client = this.manager().inner().remediations(); + return client.createOrUpdateAtManagementGroupAsync(this.managementGroupId, this.remediationName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + RemediationsInner client = this.manager().inner().remediations(); + return client.createOrUpdateAtManagementGroupAsync(this.managementGroupId, this.remediationName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + RemediationsInner client = this.manager().inner().remediations(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdOn() { + return this.inner().createdOn(); + } + + @Override + public RemediationDeploymentSummary deploymentStatus() { + return this.inner().deploymentStatus(); + } + + @Override + public RemediationFilters filters() { + return this.inner().filters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastUpdatedOn() { + return this.inner().lastUpdatedOn(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @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 String type() { + return this.inner().type(); + } + + @Override + public RemediationImpl withExistingMicrosoft.PolicyInsight(String managementGroupId) { + this.managementGroupId = managementGroupId; + return this; + } + + @Override + public RemediationImpl withDeploymentStatus(RemediationDeploymentSummary deploymentStatus) { + this.inner().withDeploymentStatus(deploymentStatus); + return this; + } + + @Override + public RemediationImpl withFilters(RemediationFilters filters) { + this.inner().withFilters(filters); + return this; + } + + @Override + public RemediationImpl withPolicyAssignmentId(String policyAssignmentId) { + this.inner().withPolicyAssignmentId(policyAssignmentId); + return this; + } + + @Override + public RemediationImpl withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.inner().withPolicyDefinitionReferenceId(policyDefinitionReferenceId); + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationInner.java new file mode 100644 index 000000000000..d15a1743d67a --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationInner.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.v2018_07_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.RemediationFilters; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.RemediationDeploymentSummary; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The remediation definition. + */ +@JsonFlatten +public class RemediationInner extends ProxyResource { + /** + * The resource ID of the policy assignment that should be remediated. + */ + @JsonProperty(value = "properties.policyAssignmentId") + private String policyAssignmentId; + + /** + * The policy definition reference ID of the individual definition that + * should be remediated. Required when the policy assignment being + * remediated assigns a policy set definition. + */ + @JsonProperty(value = "properties.policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * The status of the remediation. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The time at which the remediation was created. + */ + @JsonProperty(value = "properties.createdOn", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdOn; + + /** + * The time at which the remediation was last updated. + */ + @JsonProperty(value = "properties.lastUpdatedOn", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedOn; + + /** + * The filters that will be applied to determine which resources to + * remediate. + */ + @JsonProperty(value = "properties.filters") + private RemediationFilters filters; + + /** + * The deployment status summary for all deployments created by the + * remediation. + */ + @JsonProperty(value = "properties.deploymentStatus") + private RemediationDeploymentSummary deploymentStatus; + + /** + * Get the resource ID of the policy assignment that should be remediated. + * + * @return the policyAssignmentId value + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set the resource ID of the policy assignment that should be remediated. + * + * @param policyAssignmentId the policyAssignmentId value to set + * @return the RemediationInner object itself. + */ + public RemediationInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get the policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set the policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the RemediationInner object itself. + */ + public RemediationInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the status of the remediation. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the time at which the remediation was created. + * + * @return the createdOn value + */ + public DateTime createdOn() { + return this.createdOn; + } + + /** + * Get the time at which the remediation was last updated. + * + * @return the lastUpdatedOn value + */ + public DateTime lastUpdatedOn() { + return this.lastUpdatedOn; + } + + /** + * Get the filters that will be applied to determine which resources to remediate. + * + * @return the filters value + */ + public RemediationFilters filters() { + return this.filters; + } + + /** + * Set the filters that will be applied to determine which resources to remediate. + * + * @param filters the filters value to set + * @return the RemediationInner object itself. + */ + public RemediationInner withFilters(RemediationFilters filters) { + this.filters = filters; + return this; + } + + /** + * Get the deployment status summary for all deployments created by the remediation. + * + * @return the deploymentStatus value + */ + public RemediationDeploymentSummary deploymentStatus() { + return this.deploymentStatus; + } + + /** + * Set the deployment status summary for all deployments created by the remediation. + * + * @param deploymentStatus the deploymentStatus value to set + * @return the RemediationInner object itself. + */ + public RemediationInner withDeploymentStatus(RemediationDeploymentSummary deploymentStatus) { + this.deploymentStatus = deploymentStatus; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsImpl.java new file mode 100644 index 000000000000..d52a710f348e --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsImpl.java @@ -0,0 +1,369 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.RemediationDeployment; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediation; + +class RemediationsImpl extends WrapperImpl implements Remediations { + private final PolicyInsightsManager manager; + + RemediationsImpl(PolicyInsightsManager manager) { + super(manager.inner().remediations()); + this.manager = manager; + } + + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public RemediationImpl define(String name) { + return wrapModel(name); + } + + private RemediationImpl wrapModel(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + + private RemediationImpl wrapModel(String name) { + return new RemediationImpl(name, this.manager()); + } + + @Override + public Observable listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName) { + RemediationsInner client = this.inner(); + return client.listDeploymentsAtManagementGroupAsync(managementGroupId, remediationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RemediationDeployment call(RemediationDeploymentInner inner) { + return new RemediationDeploymentImpl(inner, manager()); + } + }); + } + + @Override + public Observable cancelAtManagementGroupAsync(String managementGroupId, String remediationName) { + RemediationsInner client = this.inner(); + return client.cancelAtManagementGroupAsync(managementGroupId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForManagementGroupAsync(final String managementGroupId) { + RemediationsInner client = this.inner(); + return client.listForManagementGroupAsync(managementGroupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtManagementGroupAsync(String managementGroupId, String remediationName) { + RemediationsInner client = this.inner(); + return client.getAtManagementGroupAsync(managementGroupId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteAtManagementGroupAsync(String managementGroupId, String remediationName) { + RemediationsInner client = this.inner(); + return client.deleteAtManagementGroupAsync(managementGroupId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName) { + RemediationsInner client = this.inner(); + return client.listDeploymentsAtSubscriptionAsync(subscriptionId, remediationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RemediationDeployment call(RemediationDeploymentInner inner) { + return new RemediationDeploymentImpl(inner, manager()); + } + }); + } + + @Override + public Observable cancelAtSubscriptionAsync(String subscriptionId, String remediationName) { + RemediationsInner client = this.inner(); + return client.cancelAtSubscriptionAsync(subscriptionId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtSubscriptionAsync(String subscriptionId, String remediationName, RemediationInner parameters) { + RemediationsInner client = this.inner(); + return client.createOrUpdateAtSubscriptionAsync(subscriptionId, remediationName, parameters) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtSubscriptionAsync(String subscriptionId, String remediationName) { + RemediationsInner client = this.inner(); + return client.getAtSubscriptionAsync(subscriptionId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteAtSubscriptionAsync(String subscriptionId, String remediationName) { + RemediationsInner client = this.inner(); + return client.deleteAtSubscriptionAsync(subscriptionId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName) { + RemediationsInner client = this.inner(); + return client.listDeploymentsAtResourceGroupAsync(subscriptionId, resourceGroupName, remediationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RemediationDeployment call(RemediationDeploymentInner inner) { + return new RemediationDeploymentImpl(inner, manager()); + } + }); + } + + @Override + public Observable cancelAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + RemediationsInner client = this.inner(); + return client.cancelAtResourceGroupAsync(subscriptionId, resourceGroupName, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName, RemediationInner parameters) { + RemediationsInner client = this.inner(); + return client.createOrUpdateAtResourceGroupAsync(subscriptionId, resourceGroupName, remediationName, parameters) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + RemediationsInner client = this.inner(); + return client.getByResourceGroupAsync(subscriptionId, resourceGroupName, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + RemediationsInner client = this.inner(); + return client.deleteAtResourceGroupAsync(subscriptionId, resourceGroupName, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listDeploymentsAtResourceAsync(final String resourceId, final String remediationName) { + RemediationsInner client = this.inner(); + return client.listDeploymentsAtResourceAsync(resourceId, remediationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RemediationDeployment call(RemediationDeploymentInner inner) { + return new RemediationDeploymentImpl(inner, manager()); + } + }); + } + + @Override + public Observable cancelAtResourceAsync(String resourceId, String remediationName) { + RemediationsInner client = this.inner(); + return client.cancelAtResourceAsync(resourceId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtResourceAsync(String resourceId, String remediationName, RemediationInner parameters) { + RemediationsInner client = this.inner(); + return client.createOrUpdateAtResourceAsync(resourceId, remediationName, parameters) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtResourceAsync(String resourceId, String remediationName) { + RemediationsInner client = this.inner(); + return client.getAtResourceAsync(resourceId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteAtResourceAsync(String resourceId, String remediationName) { + RemediationsInner client = this.inner(); + return client.deleteAtResourceAsync(resourceId, remediationName) + .map(new Func1() { + @Override + public Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync(final String subscriptionId) { + RemediationsInner 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 Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String subscriptionId, final String resourceGroupName) { + RemediationsInner 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 Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForResourceAsync(final String resourceId) { + RemediationsInner 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 Remediation call(RemediationInner inner) { + return new RemediationImpl(inner, manager()); + } + }); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java new file mode 100644 index 000000000000..12edd06ce850 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/RemediationsInner.java @@ -0,0 +1,4372 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.ErrorResponseException; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.QueryOptions; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import 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.POST; +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 Remediations. + */ +public class RemediationsInner { + /** The Retrofit service to perform REST calls. */ + private RemediationsService service; + /** The service client containing this operation class. */ + private PolicyInsightsClientImpl client; + + /** + * Initializes an instance of RemediationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RemediationsInner(Retrofit retrofit, PolicyInsightsClientImpl client) { + this.service = retrofit.create(RemediationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Remediations to be + * used by Retrofit to perform actually REST calls. + */ + interface RemediationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listDeploymentsAtManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + Observable> listDeploymentsAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations cancelAtManagementGroup" }) + @POST("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + Observable> cancelAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listForManagementGroup" }) + @GET("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations") + Observable> listForManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @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.v2018_07_01_preview.Remediations createOrUpdateAtManagementGroup" }) + @PUT("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> createOrUpdateAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Body RemediationInner 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.v2018_07_01_preview.Remediations getAtManagementGroup" }) + @GET("providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> getAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations deleteAtManagementGroup" }) + @HTTP(path = "providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroup(@Path("managementGroupsNamespace") String managementGroupsNamespace, @Path("managementGroupId") String managementGroupId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listDeploymentsAtSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + Observable> listDeploymentsAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations cancelAtSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + Observable> cancelAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations") + 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.v2018_07_01_preview.Remediations createOrUpdateAtSubscription" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> createOrUpdateAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Body RemediationInner 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.v2018_07_01_preview.Remediations getAtSubscription" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> getAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations deleteAtSubscription" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", method = "DELETE", hasBody = true) + Observable> deleteAtSubscription(@Path("subscriptionId") String subscriptionId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listDeploymentsAtResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + Observable> listDeploymentsAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations cancelAtResourceGroup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + Observable> cancelAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations") + 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.v2018_07_01_preview.Remediations createOrUpdateAtResourceGroup" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> createOrUpdateAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Body RemediationInner 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.v2018_07_01_preview.Remediations getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations deleteAtResourceGroup" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", method = "DELETE", hasBody = true) + Observable> deleteAtResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listDeploymentsAtResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + Observable> listDeploymentsAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$top") Integer top, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations cancelAtResource" }) + @POST("{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + Observable> cancelAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listForResource" }) + @GET("{resourceId}/providers/Microsoft.PolicyInsights/remediations") + 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.v2018_07_01_preview.Remediations createOrUpdateAtResource" }) + @PUT("{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> createOrUpdateAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Body RemediationInner 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.v2018_07_01_preview.Remediations getAtResource" }) + @GET("{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + Observable> getAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations deleteAtResource" }) + @HTTP(path = "{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", method = "DELETE", hasBody = true) + Observable> deleteAtResource(@Path(value = "resourceId", encoded = true) String resourceId, @Path("remediationName") String remediationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listDeploymentsAtManagementGroupNext" }) + @GET + Observable> listDeploymentsAtManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listForManagementGroupNext" }) + @GET + Observable> listForManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listDeploymentsAtSubscriptionNext" }) + @GET + Observable> listDeploymentsAtSubscriptionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations 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.v2018_07_01_preview.Remediations listDeploymentsAtResourceGroupNext" }) + @GET + Observable> listDeploymentsAtResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations 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.v2018_07_01_preview.Remediations listDeploymentsAtResourceNext" }) + @GET + Observable> listDeploymentsAtResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Remediations listForResourceNext" }) + @GET + Observable> listForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtManagementGroup(final String managementGroupId, final String remediationName) { + ServiceResponse> response = listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName) { + return listDeploymentsAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtManagementGroupWithServiceResponseAsync(final String managementGroupId, final String remediationName) { + return listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName) + .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(listDeploymentsAtManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtManagementGroupSinglePageAsync(final String managementGroupId, final String remediationName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtManagementGroup(final String managementGroupId, final String remediationName, final QueryOptions queryOptions) { + ServiceResponse> response = listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtManagementGroupAsync(final String managementGroupId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtManagementGroupWithServiceResponseAsync(final String managementGroupId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, 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(listDeploymentsAtManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + ServiceResponse> * @param managementGroupId Management group ID. + ServiceResponse> * @param remediationName The name of the remediation. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtManagementGroupSinglePageAsync(final String managementGroupId, final String remediationName, final QueryOptions queryOptions) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + return service.listDeploymentsAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtManagementGroupDelegate(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); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner cancelAtManagementGroup(String managementGroupId, String remediationName) { + return cancelAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).toBlocking().single().body(); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 cancelAtManagementGroupAsync(String managementGroupId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName), serviceCallback); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable cancelAtManagementGroupAsync(String managementGroupId, String remediationName) { + return cancelAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> cancelAtManagementGroupWithServiceResponseAsync(String managementGroupId, String remediationName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + return service.cancelAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtManagementGroupDelegate(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); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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<RemediationInner> object if successful. + */ + public PagedList listForManagementGroup(final String managementGroupId) { + ServiceResponse> response = listForManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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> listForManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> object + */ + public Observable> listForManagementGroupAsync(final String managementGroupId) { + return listForManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> object + */ + public Observable>> listForManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listForManagementGroupSinglePageAsync(managementGroupId) + .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(listForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + String filter = null; + return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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<RemediationInner> object if successful. + */ + public PagedList listForManagementGroup(final String managementGroupId, final QueryOptions queryOptions) { + ServiceResponse> response = listForManagementGroupSinglePageAsync(managementGroupId, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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> listForManagementGroupAsync(final String managementGroupId, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForManagementGroupSinglePageAsync(managementGroupId, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> object + */ + public Observable> listForManagementGroupAsync(final String managementGroupId, final QueryOptions queryOptions) { + return listForManagementGroupWithServiceResponseAsync(managementGroupId, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> object + */ + public Observable>> listForManagementGroupWithServiceResponseAsync(final String managementGroupId, final QueryOptions queryOptions) { + return listForManagementGroupSinglePageAsync(managementGroupId, 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(listForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all remediations for the management group. + * + ServiceResponse> * @param managementGroupId Management group ID. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForManagementGroupSinglePageAsync(final String managementGroupId, final QueryOptions queryOptions) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + Validator.validate(queryOptions); + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + String filter = null; + if (queryOptions != null) { + filter = queryOptions.filter(); + } + return service.listForManagementGroup(managementGroupsNamespace, managementGroupId, apiVersion, this.client.acceptLanguage(), top, filter, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForManagementGroupDelegate(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 a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 RemediationInner object if successful. + */ + public RemediationInner createOrUpdateAtManagementGroup(String managementGroupId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 createOrUpdateAtManagementGroupAsync(String managementGroupId, String remediationName, RemediationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName, parameters), serviceCallback); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable createOrUpdateAtManagementGroupAsync(String managementGroupId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName, parameters).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String managementGroupId, String remediationName, RemediationInner parameters) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + return service.createOrUpdateAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtManagementGroupDelegate(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 remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner getAtManagementGroup(String managementGroupId, String remediationName) { + return getAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).toBlocking().single().body(); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 getAtManagementGroupAsync(String managementGroupId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName), serviceCallback); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable getAtManagementGroupAsync(String managementGroupId, String remediationName) { + return getAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> getAtManagementGroupWithServiceResponseAsync(String managementGroupId, String remediationName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + return service.getAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupDelegate(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 remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner deleteAtManagementGroup(String managementGroupId, String remediationName) { + return deleteAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).toBlocking().single().body(); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @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 deleteAtManagementGroupAsync(String managementGroupId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName), serviceCallback); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable deleteAtManagementGroupAsync(String managementGroupId, String remediationName) { + return deleteAtManagementGroupWithServiceResponseAsync(managementGroupId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> deleteAtManagementGroupWithServiceResponseAsync(String managementGroupId, String remediationName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2018-07-01-preview"; + return service.deleteAtManagementGroup(managementGroupsNamespace, managementGroupId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtManagementGroupDelegate(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 deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtSubscription(final String subscriptionId, final String remediationName) { + ServiceResponse> response = listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName) { + return listDeploymentsAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtSubscriptionWithServiceResponseAsync(final String subscriptionId, final String remediationName) { + return listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName) + .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(listDeploymentsAtSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtSubscriptionSinglePageAsync(final String subscriptionId, final String remediationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + return service.listDeploymentsAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtSubscription(final String subscriptionId, final String remediationName, final QueryOptions queryOptions) { + ServiceResponse> response = listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtSubscriptionAsync(final String subscriptionId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtSubscriptionWithServiceResponseAsync(final String subscriptionId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtSubscriptionSinglePageAsync(subscriptionId, remediationName, 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(listDeploymentsAtSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param remediationName The name of the remediation. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtSubscriptionSinglePageAsync(final String subscriptionId, final String remediationName, final QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + return service.listDeploymentsAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtSubscriptionDelegate(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); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner cancelAtSubscription(String subscriptionId, String remediationName) { + return cancelAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).toBlocking().single().body(); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 cancelAtSubscriptionAsync(String subscriptionId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName), serviceCallback); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable cancelAtSubscriptionAsync(String subscriptionId, String remediationName) { + return cancelAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> cancelAtSubscriptionWithServiceResponseAsync(String subscriptionId, String remediationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.cancelAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtSubscriptionDelegate(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); + } + + /** + * Gets all remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> 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 = "2018-07-01-preview"; + 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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> 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 remediations for the subscription. + * + * @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 PagedList<RemediationInner> 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 remediations for the subscription. + * + * @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 PagedList<RemediationInner> 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 remediations for 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<RemediationInner> 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 = "2018-07-01-preview"; + 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 a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 RemediationInner object if successful. + */ + public RemediationInner createOrUpdateAtSubscription(String subscriptionId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 remediationName, RemediationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName, parameters), serviceCallback); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable createOrUpdateAtSubscriptionAsync(String subscriptionId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName, parameters).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> createOrUpdateAtSubscriptionWithServiceResponseAsync(String subscriptionId, String remediationName, RemediationInner parameters) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-07-01-preview"; + return service.createOrUpdateAtSubscription(subscriptionId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtSubscriptionDelegate(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 remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner getAtSubscription(String subscriptionId, String remediationName) { + return getAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).toBlocking().single().body(); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName), serviceCallback); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable getAtSubscriptionAsync(String subscriptionId, String remediationName) { + return getAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> getAtSubscriptionWithServiceResponseAsync(String subscriptionId, String remediationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.getAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner deleteAtSubscription(String subscriptionId, String remediationName) { + return deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).toBlocking().single().body(); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName), serviceCallback); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable deleteAtSubscriptionAsync(String subscriptionId, String remediationName) { + return deleteAtSubscriptionWithServiceResponseAsync(subscriptionId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> deleteAtSubscriptionWithServiceResponseAsync(String subscriptionId, String remediationName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.deleteAtSubscription(subscriptionId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResourceGroup(final String subscriptionId, final String resourceGroupName, final String remediationName) { + ServiceResponse> response = listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName) { + return listDeploymentsAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String remediationName) { + return listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName) + .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(listDeploymentsAtResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceGroupSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String remediationName) { + 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResourceGroup(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions) { + ServiceResponse> response = listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceGroupAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceGroupWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, remediationName, 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(listDeploymentsAtResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + ServiceResponse> * @param subscriptionId Microsoft Azure subscription ID. + ServiceResponse> * @param resourceGroupName Resource group name. + ServiceResponse> * @param remediationName The name of the remediation. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceGroupSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String remediationName, final QueryOptions queryOptions) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + return service.listDeploymentsAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtResourceGroupDelegate(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); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner cancelAtResourceGroup(String subscriptionId, String resourceGroupName, String remediationName) { + return cancelAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).toBlocking().single().body(); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 cancelAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName), serviceCallback); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable cancelAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + return cancelAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> cancelAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String remediationName) { + 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.cancelAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtResourceGroupDelegate(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); + } + + /** + * Gets all remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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> 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 remediations for the subscription. + * + * @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<RemediationInner> 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 remediations for the subscription. + * + * @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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> 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 = "2018-07-01-preview"; + 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @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<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PagedList<RemediationInner> 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 remediations for the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @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 PagedList<RemediationInner> 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 remediations for the subscription. + * + 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<RemediationInner> 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 = "2018-07-01-preview"; + 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 a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 RemediationInner object if successful. + */ + public RemediationInner createOrUpdateAtResourceGroup(String subscriptionId, String resourceGroupName, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 remediationName, RemediationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName, parameters), serviceCallback); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable createOrUpdateAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName, parameters).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> createOrUpdateAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String remediationName, RemediationInner 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-07-01-preview"; + return service.createOrUpdateAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtResourceGroupDelegate(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 remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner getByResourceGroup(String subscriptionId, String resourceGroupName, String remediationName) { + return getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).toBlocking().single().body(); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName), serviceCallback); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable getByResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + return getByResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String remediationName) { + 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.getByResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner deleteAtResourceGroup(String subscriptionId, String resourceGroupName, String remediationName) { + return deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).toBlocking().single().body(); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName), serviceCallback); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable deleteAtResourceGroupAsync(String subscriptionId, String resourceGroupName, String remediationName) { + return deleteAtResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> deleteAtResourceGroupWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String remediationName) { + 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 (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.deleteAtResourceGroup(subscriptionId, resourceGroupName, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResource(final String resourceId, final String remediationName) { + ServiceResponse> response = listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtResourceAsync(final String resourceId, final String remediationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceAsync(final String resourceId, final String remediationName) { + return listDeploymentsAtResourceWithServiceResponseAsync(resourceId, remediationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceWithServiceResponseAsync(final String resourceId, final String remediationName) { + return listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName) + .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(listDeploymentsAtResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceSinglePageAsync(final String resourceId, final String remediationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + final QueryOptions queryOptions = null; + Integer top = null; + return service.listDeploymentsAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResource(final String resourceId, final String remediationName, final QueryOptions queryOptions) { + ServiceResponse> response = listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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> listDeploymentsAtResourceAsync(final String resourceId, final String remediationName, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceAsync(final String resourceId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtResourceWithServiceResponseAsync(resourceId, remediationName, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceWithServiceResponseAsync(final String resourceId, final String remediationName, final QueryOptions queryOptions) { + return listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, 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(listDeploymentsAtResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + ServiceResponse> * @param resourceId Resource ID. + ServiceResponse> * @param remediationName The name of the remediation. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceSinglePageAsync(final String resourceId, final String remediationName, final QueryOptions queryOptions) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + Validator.validate(queryOptions); + final String apiVersion = "2018-07-01-preview"; + Integer top = null; + if (queryOptions != null) { + top = queryOptions.top(); + } + return service.listDeploymentsAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), top, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtResourceDelegate(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); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner cancelAtResource(String resourceId, String remediationName) { + return cancelAtResourceWithServiceResponseAsync(resourceId, remediationName).toBlocking().single().body(); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 cancelAtResourceAsync(String resourceId, String remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtResourceWithServiceResponseAsync(resourceId, remediationName), serviceCallback); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable cancelAtResourceAsync(String resourceId, String remediationName) { + return cancelAtResourceWithServiceResponseAsync(resourceId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> cancelAtResourceWithServiceResponseAsync(String resourceId, String remediationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.cancelAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtResourceDelegate(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); + } + + /** + * Gets all remediations 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<RemediationInner> 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 remediations 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 remediations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> 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 remediations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RemediationInner> 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 remediations for a resource. + * + * @param resourceId Resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationInner> 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 = "2018-07-01-preview"; + 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 remediations 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<RemediationInner> 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 remediations 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 = "2018-07-01-preview"; + 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 a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 RemediationInner object if successful. + */ + public RemediationInner createOrUpdateAtResource(String resourceId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceWithServiceResponseAsync(resourceId, remediationName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation 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 remediationName, RemediationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtResourceWithServiceResponseAsync(resourceId, remediationName, parameters), serviceCallback); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable createOrUpdateAtResourceAsync(String resourceId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceWithServiceResponseAsync(resourceId, remediationName, parameters).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> createOrUpdateAtResourceWithServiceResponseAsync(String resourceId, String remediationName, RemediationInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-07-01-preview"; + return service.createOrUpdateAtResource(resourceId, remediationName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtResourceDelegate(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 remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner getAtResource(String resourceId, String remediationName) { + return getAtResourceWithServiceResponseAsync(resourceId, remediationName).toBlocking().single().body(); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtResourceWithServiceResponseAsync(resourceId, remediationName), serviceCallback); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable getAtResourceAsync(String resourceId, String remediationName) { + return getAtResourceWithServiceResponseAsync(resourceId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> getAtResourceWithServiceResponseAsync(String resourceId, String remediationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.getAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 RemediationInner object if successful. + */ + public RemediationInner deleteAtResource(String resourceId, String remediationName) { + return deleteAtResourceWithServiceResponseAsync(resourceId, remediationName).toBlocking().single().body(); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @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 remediationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtResourceWithServiceResponseAsync(resourceId, remediationName), serviceCallback); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable deleteAtResourceAsync(String resourceId, String remediationName) { + return deleteAtResourceWithServiceResponseAsync(resourceId, remediationName).map(new Func1, RemediationInner>() { + @Override + public RemediationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RemediationInner object + */ + public Observable> deleteAtResourceWithServiceResponseAsync(String resourceId, String remediationName) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (remediationName == null) { + throw new IllegalArgumentException("Parameter remediationName is required and cannot be null."); + } + final String apiVersion = "2018-07-01-preview"; + return service.deleteAtResource(resourceId, remediationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .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 deployments for a remediation at management group scope. + * + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @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> listDeploymentsAtManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtManagementGroupNextAsync(final String nextPageLink) { + return listDeploymentsAtManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listDeploymentsAtManagementGroupNextSinglePageAsync(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(listDeploymentsAtManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtManagementGroupNextSinglePageAsync(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.listDeploymentsAtManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtManagementGroupNextDelegate(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 remediations for the management 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<RemediationInner> object if successful. + */ + public PagedList listForManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all remediations for 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> listForManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all remediations for 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<RemediationInner> object + */ + public Observable> listForManagementGroupNextAsync(final String nextPageLink) { + return listForManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all remediations for 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<RemediationInner> object + */ + public Observable>> listForManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listForManagementGroupNextSinglePageAsync(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(listForManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all remediations for 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<RemediationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForManagementGroupNextSinglePageAsync(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.listForManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForManagementGroupNextDelegate(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 deployments for a remediation at subscription scope. + * + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtSubscriptionNext(final String nextPageLink) { + ServiceResponse> response = listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @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> listDeploymentsAtSubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtSubscriptionNextAsync(final String nextPageLink) { + return listDeploymentsAtSubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtSubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listDeploymentsAtSubscriptionNextSinglePageAsync(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(listDeploymentsAtSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtSubscriptionNextSinglePageAsync(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.listDeploymentsAtSubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtSubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtSubscriptionNextDelegate(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 remediations 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<RemediationInner> 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 remediations 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 deployments for a remediation at resource group scope. + * + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @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> listDeploymentsAtResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceGroupNextAsync(final String nextPageLink) { + return listDeploymentsAtResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listDeploymentsAtResourceGroupNextSinglePageAsync(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(listDeploymentsAtResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceGroupNextSinglePageAsync(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.listDeploymentsAtResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtResourceGroupNextDelegate(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 remediations 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<RemediationInner> 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 remediations 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> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 deployments for a remediation at resource scope. + * + * @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<RemediationDeploymentInner> object if successful. + */ + public PagedList listDeploymentsAtResourceNext(final String nextPageLink) { + ServiceResponse> response = listDeploymentsAtResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @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> listDeploymentsAtResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeploymentsAtResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable> listDeploymentsAtResourceNextAsync(final String nextPageLink) { + return listDeploymentsAtResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @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<RemediationDeploymentInner> object + */ + public Observable>> listDeploymentsAtResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listDeploymentsAtResourceNextSinglePageAsync(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(listDeploymentsAtResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RemediationDeploymentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeploymentsAtResourceNextSinglePageAsync(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.listDeploymentsAtResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeploymentsAtResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeploymentsAtResourceNextDelegate(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 remediations 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<RemediationInner> 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 remediations 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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 remediations 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<RemediationInner> 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/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/SummarizeResultsImpl.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/SummarizeResultsImpl.java new file mode 100644 index 000000000000..8442aa5eb15d --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/SummarizeResultsImpl.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.SummarizeResults; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Summary; + +class SummarizeResultsImpl extends WrapperImpl implements SummarizeResults { + private final PolicyInsightsManager manager; + SummarizeResultsImpl(SummarizeResultsInner inner, PolicyInsightsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PolicyInsightsManager manager() { + return this.manager; + } + + @Override + public String odatacontext() { + return this.inner().odatacontext(); + } + + @Override + public Integer odatacount() { + return this.inner().odatacount(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/SummarizeResultsInner.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/SummarizeResultsInner.java new file mode 100644 index 000000000000..27a60425c098 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/SummarizeResultsInner.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.Summary; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Summarize action results. + */ +public class SummarizeResultsInner { + /** + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata\\.context") + private String odatacontext; + + /** + * OData entity count; represents the number of summaries returned; always + * set to 1. + */ + @JsonProperty(value = "@odata\\.count") + private Integer odatacount; + + /** + * Summarize action results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get oData context string; used by OData clients to resolve type information based on metadata. + * + * @return the odatacontext value + */ + public String odatacontext() { + return this.odatacontext; + } + + /** + * Set oData context string; used by OData clients to resolve type information based on metadata. + * + * @param odatacontext the odatacontext value to set + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withOdatacontext(String odatacontext) { + this.odatacontext = odatacontext; + return this; + } + + /** + * Get oData entity count; represents the number of summaries returned; always set to 1. + * + * @return the odatacount value + */ + public Integer odatacount() { + return this.odatacount; + } + + /** + * Set oData entity count; represents the number of summaries returned; always set to 1. + * + * @param odatacount the odatacount value to set + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withOdatacount(Integer odatacount) { + this.odatacount = odatacount; + return this; + } + + /** + * Get summarize action results. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set summarize action results. + * + * @param value the value value to set + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/package-info.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/package-info.java new file mode 100644 index 000000000000..492813c20cce --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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. + +/** + * This package contains the implementation classes for PolicyInsightsClient. + */ +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; diff --git a/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/package-info.java b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/package-info.java new file mode 100644 index 000000000000..bbd0b117fa08 --- /dev/null +++ b/policyinsights/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/package-info.java @@ -0,0 +1,10 @@ +// 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. + +/** + * This package contains the classes for PolicyInsightsClient. + */ +package com.microsoft.azure.management.policyinsights.v2018_07_01_preview;