diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md b/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md index f0a34565a57a0..e55506d7f7b97 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2021-09-30) +- Azure Resource Manager PolicyInsights client library for Java. This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.1 (2021-04-22) diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md b/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md index 61af264c7752e..6686635db719e 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md @@ -2,7 +2,7 @@ Azure Resource Manager PolicyInsights client library for Java. -This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-policyinsights - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,8 @@ See [API design][design] for general introduction on design and key concepts on ## Examples + + ## Troubleshooting ## Next steps diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml b/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml index 3d30e92ff968d..d0cc292b1ddf8 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml @@ -1,67 +1,86 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-policyinsights - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-policyinsights + 1.0.0-beta.2 + jar - Microsoft Azure SDK for PolicyInsights Management - This package contains Microsoft Azure SDK for PolicyInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-01. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for PolicyInsights Management + This package contains Microsoft Azure SDK for PolicyInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-10. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + - - https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - microsoft - Microsoft - - - - UTF-8 - - - - - com.azure - azure-core - 1.20.0 - - - com.azure - azure-core-management - 1.4.1 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.7 - - true - - - - + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.20.0 + + + com.azure + azure-core-management + 1.4.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.java index 07fc8feee1c5e..fd85dc19d5e00 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.java +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.java @@ -9,7 +9,6 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +16,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -105,6 +105,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -144,6 +145,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { return this; } + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + /** * Sets the retry policy to the HTTP pipeline. * @@ -200,6 +212,9 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } @@ -209,10 +224,7 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationInner.java index 94d55a1a361db..3a80feda1868d 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationInner.java +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationInner.java @@ -7,9 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.policyinsights.models.RemediationDeploymentSummary; import com.azure.resourcemanager.policyinsights.models.RemediationFilters; +import com.azure.resourcemanager.policyinsights.models.RemediationPropertiesFailureThreshold; import com.azure.resourcemanager.policyinsights.models.ResourceDiscoveryMode; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -21,6 +23,13 @@ public class RemediationInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationInner.class); + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + /* * The resource ID of the policy assignment that should be remediated. */ @@ -74,6 +83,50 @@ public class RemediationInner extends ProxyResource { @JsonProperty(value = "properties.deploymentStatus", access = JsonProperty.Access.WRITE_ONLY) private RemediationDeploymentSummary deploymentStatus; + /* + * The remediation status message. Provides additional details regarding + * the state of the remediation. + */ + @JsonProperty(value = "properties.statusMessage", access = JsonProperty.Access.WRITE_ONLY) + private String statusMessage; + + /* + * The remediation correlation Id. Can be used to find events related to + * the remediation in the activity log. + */ + @JsonProperty(value = "properties.correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /* + * Determines the max number of resources that can be remediated by the + * remediation job. If not provided, the default resource count is used. + */ + @JsonProperty(value = "properties.resourceCount") + private Integer resourceCount; + + /* + * Determines how many resources to remediate at any given time. Can be + * used to increase or reduce the pace of the remediation. If not provided, + * the default parallel deployments value is used. + */ + @JsonProperty(value = "properties.parallelDeployments") + private Integer parallelDeployments; + + /* + * The remediation failure threshold settings + */ + @JsonProperty(value = "properties.failureThreshold") + private RemediationPropertiesFailureThreshold failureThreshold; + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the policyAssignmentId property: The resource ID of the policy assignment that should be remediated. * @@ -194,6 +247,92 @@ public RemediationDeploymentSummary deploymentStatus() { return this.deploymentStatus; } + /** + * Get the statusMessage property: The remediation status message. Provides additional details regarding the state + * of the remediation. + * + * @return the statusMessage value. + */ + public String statusMessage() { + return this.statusMessage; + } + + /** + * Get the correlationId property: The remediation correlation Id. Can be used to find events related to the + * remediation in the activity log. + * + * @return the correlationId value. + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Get the resourceCount property: Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * + * @return the resourceCount value. + */ + public Integer resourceCount() { + return this.resourceCount; + } + + /** + * Set the resourceCount property: Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * + * @param resourceCount the resourceCount value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withResourceCount(Integer resourceCount) { + this.resourceCount = resourceCount; + return this; + } + + /** + * Get the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used + * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is + * used. + * + * @return the parallelDeployments value. + */ + public Integer parallelDeployments() { + return this.parallelDeployments; + } + + /** + * Set the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used + * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is + * used. + * + * @param parallelDeployments the parallelDeployments value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withParallelDeployments(Integer parallelDeployments) { + this.parallelDeployments = parallelDeployments; + return this; + } + + /** + * Get the failureThreshold property: The remediation failure threshold settings. + * + * @return the failureThreshold value. + */ + public RemediationPropertiesFailureThreshold failureThreshold() { + return this.failureThreshold; + } + + /** + * Set the failureThreshold property: The remediation failure threshold settings. + * + * @param failureThreshold the failureThreshold value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold) { + this.failureThreshold = failureThreshold; + return this; + } + /** * Validates the instance. * @@ -206,5 +345,8 @@ public void validate() { if (deploymentStatus() != null) { deploymentStatus().validate(); } + if (failureThreshold() != null) { + failureThreshold().validate(); + } } } diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java index 1292534dc8985..000c8e026abb1 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java @@ -251,85 +251,12 @@ Mono> listQueryResultsForResourceGroupLevelPo @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForManagementGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForSubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForResourceNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForPolicySetDefinitionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForPolicyDefinitionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForSubscriptionLevelPolicyAssignmentNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) + @Headers({"Accept: application/json", "Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForResourceGroupLevelPolicyAssignmentNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + Mono> nextLink( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); } /** @@ -526,7 +453,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -552,7 +479,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync(Stri () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -594,7 +521,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken, context), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -849,7 +776,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -875,7 +802,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync(String () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -917,7 +844,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1188,7 +1115,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( () -> listQueryResultsForResourceGroupSinglePageAsync( subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1216,7 +1143,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( () -> listQueryResultsForResourceGroupSinglePageAsync( subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1270,7 +1197,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1537,7 +1464,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1564,7 +1491,7 @@ private PagedFlux listQueryResultsForResourceAsync(String reso () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1608,7 +1535,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken, context), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1888,7 +1815,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( () -> listQueryResultsForPolicySetDefinitionSinglePageAsync( subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1916,7 +1843,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( () -> listQueryResultsForPolicySetDefinitionSinglePageAsync( subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1970,7 +1897,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -2259,7 +2186,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( () -> listQueryResultsForPolicyDefinitionSinglePageAsync( subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2287,7 +2214,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( () -> listQueryResultsForPolicyDefinitionSinglePageAsync( subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2341,7 +2268,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -2630,7 +2557,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs () -> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2658,7 +2585,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs () -> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2712,7 +2639,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -3027,7 +2954,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -3066,7 +2993,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -3123,7 +3050,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -3228,171 +3155,12 @@ public PagedIterable listQueryResultsForResourceGroupLevelPoli * @return query results. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( - String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForSubscriptionNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service.listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForSubscriptionNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForResourceGroupNextSinglePageAsync(String nextLink) { + private Mono> nextLinkSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service.listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .withContext(context -> service.nextLink(nextLink, context)) .>map( res -> new PagedResponseBase<>( @@ -3416,404 +3184,13 @@ private Mono> listQueryResultsForResourceGroupNe * @return query results. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForResourceGroupNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForResourceNextSinglePageAsync(String nextLink) { + private Mono> nextLinkSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service.listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForResourceNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForPolicySetDefinitionNextSinglePageAsync( - String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForPolicySetDefinitionNext( - nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForPolicySetDefinitionNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForPolicySetDefinitionNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForPolicyDefinitionNextSinglePageAsync( - String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForPolicyDefinitionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForPolicyDefinitionNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForPolicyDefinitionNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForSubscriptionLevelPolicyAssignmentNext( - nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForSubscriptionLevelPolicyAssignmentNext( - nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForResourceGroupLevelPolicyAssignmentNext( - nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listQueryResultsForResourceGroupLevelPolicyAssignmentNext( - nextLink, this.client.getEndpoint(), accept, context) + .nextLink(nextLink, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesClientImpl.java index 3be83bbff99ed..f66fa8585f1fe 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesClientImpl.java +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesClientImpl.java @@ -441,85 +441,12 @@ Mono> summarizeForResourceGroupLevelPolicyAssign @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForManagementGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForSubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForResourceNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForPolicySetDefinitionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForPolicyDefinitionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForSubscriptionLevelPolicyAssignmentNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) + @Headers({"Accept: application/json", "Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForResourceGroupLevelPolicyAssignmentNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + Mono> nextLink( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); } /** @@ -740,7 +667,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -778,7 +705,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -833,7 +760,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1325,7 +1252,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1354,7 +1281,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1409,7 +1336,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1910,7 +1837,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1950,7 +1877,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2008,7 +1935,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -2546,7 +2473,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2576,7 +2503,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2634,7 +2561,7 @@ private PagedFlux listQueryResultsForResourceAsync( expand, skipToken, context), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -3544,7 +3471,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -3584,7 +3511,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -3642,7 +3569,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -4212,7 +4139,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -4252,7 +4179,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -4310,7 +4237,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -4876,7 +4803,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -4916,7 +4843,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -4974,7 +4901,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -5560,7 +5487,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -5605,7 +5532,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -5666,7 +5593,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -6040,171 +5967,12 @@ public Response summarizeForResourceGroupLevelPolicyAssig * @return query results. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( - String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForSubscriptionNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service.listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForSubscriptionNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForResourceGroupNextSinglePageAsync(String nextLink) { + private Mono> nextLinkSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service.listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .withContext(context -> service.nextLink(nextLink, context)) .>map( res -> new PagedResponseBase<>( @@ -6228,404 +5996,13 @@ private Mono> listQueryResultsForResourceGroupNe * @return query results. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForResourceGroupNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForResourceNextSinglePageAsync(String nextLink) { + private Mono> nextLinkSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service.listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForResourceNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForPolicySetDefinitionNextSinglePageAsync( - String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForPolicySetDefinitionNext( - nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForPolicySetDefinitionNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForPolicySetDefinitionNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForPolicyDefinitionNextSinglePageAsync( - String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForPolicyDefinitionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listQueryResultsForPolicyDefinitionNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForPolicyDefinitionNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForSubscriptionLevelPolicyAssignmentNext( - nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listQueryResultsForSubscriptionLevelPolicyAssignmentNext( - nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listQueryResultsForResourceGroupLevelPolicyAssignmentNext( - nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query results. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listQueryResultsForResourceGroupLevelPolicyAssignmentNext( - nextLink, this.client.getEndpoint(), accept, context) + .nextLink(nextLink, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationImpl.java index a627d6c15a81d..2ea8054111e77 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationImpl.java +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationImpl.java @@ -4,11 +4,16 @@ package com.azure.resourcemanager.policyinsights.implementation; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; import com.azure.resourcemanager.policyinsights.models.Remediation; +import com.azure.resourcemanager.policyinsights.models.RemediationDeployment; import com.azure.resourcemanager.policyinsights.models.RemediationDeploymentSummary; import com.azure.resourcemanager.policyinsights.models.RemediationFilters; +import com.azure.resourcemanager.policyinsights.models.RemediationPropertiesFailureThreshold; import com.azure.resourcemanager.policyinsights.models.ResourceDiscoveryMode; import java.time.OffsetDateTime; @@ -29,6 +34,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String policyAssignmentId() { return this.innerModel().policyAssignmentId(); } @@ -61,6 +70,26 @@ public RemediationDeploymentSummary deploymentStatus() { return this.innerModel().deploymentStatus(); } + public String statusMessage() { + return this.innerModel().statusMessage(); + } + + public String correlationId() { + return this.innerModel().correlationId(); + } + + public Integer resourceCount() { + return this.innerModel().resourceCount(); + } + + public Integer parallelDeployments() { + return this.innerModel().parallelDeployments(); + } + + public RemediationPropertiesFailureThreshold failureThreshold() { + return this.innerModel().failureThreshold(); + } + public RemediationInner innerModel() { return this.innerObject; } @@ -160,6 +189,26 @@ public Remediation refresh(Context context) { return this; } + public PagedIterable listDeploymentsAtResourceGroup() { + return serviceManager.remediations().listDeploymentsAtResourceGroup(resourceGroupName, remediationName); + } + + public PagedIterable listDeploymentsAtResourceGroup(Integer top, Context context) { + return serviceManager + .remediations() + .listDeploymentsAtResourceGroup(resourceGroupName, remediationName, top, context); + } + + public Remediation cancelAtResourceGroup() { + return serviceManager.remediations().cancelAtResourceGroup(resourceGroupName, remediationName); + } + + public Response cancelAtResourceGroupWithResponse(Context context) { + return serviceManager + .remediations() + .cancelAtResourceGroupWithResponse(resourceGroupName, remediationName, context); + } + public RemediationImpl withPolicyAssignmentId(String policyAssignmentId) { this.innerModel().withPolicyAssignmentId(policyAssignmentId); return this; @@ -179,4 +228,19 @@ public RemediationImpl withFilters(RemediationFilters filters) { this.innerModel().withFilters(filters); return this; } + + public RemediationImpl withResourceCount(Integer resourceCount) { + this.innerModel().withResourceCount(resourceCount); + return this; + } + + public RemediationImpl withParallelDeployments(Integer parallelDeployments) { + this.innerModel().withParallelDeployments(parallelDeployments); + return this; + } + + public RemediationImpl withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold) { + this.innerModel().withFailureThreshold(failureThreshold); + return this; + } } diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsClientImpl.java index 7b056577ff5c3..ead084752cb6b 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsClientImpl.java +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsClientImpl.java @@ -514,7 +514,7 @@ private Mono> listDeploymentsAtManagem .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -571,7 +571,7 @@ private Mono> listDeploymentsAtManagem .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -717,7 +717,7 @@ private Mono> cancelAtManagementGroupWithResponseAsyn .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -763,7 +763,7 @@ private Mono> cancelAtManagementGroupWithResponseAsyn .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -857,7 +857,7 @@ private Mono> listForManagementGroupSinglePageAs .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -910,7 +910,7 @@ private Mono> listForManagementGroupSinglePageAs .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1059,7 +1059,7 @@ private Mono> createOrUpdateAtManagementGroupWithResp parameters.validate(); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1112,7 +1112,7 @@ private Mono> createOrUpdateAtManagementGroupWithResp parameters.validate(); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1216,7 +1216,7 @@ private Mono> getAtManagementGroupWithResponseAsync( .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1262,7 +1262,7 @@ private Mono> getAtManagementGroupWithResponseAsync( .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1359,7 +1359,7 @@ private Mono> deleteAtManagementGroupWithResponseAsyn .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1405,7 +1405,7 @@ private Mono> deleteAtManagementGroupWithResponseAsyn .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1503,7 +1503,7 @@ private Mono> listDeploymentsAtSubscri return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1559,7 +1559,7 @@ private Mono> listDeploymentsAtSubscri return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1695,7 +1695,7 @@ private Mono> cancelAtSubscriptionWithResponseAsync(S return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1740,7 +1740,7 @@ private Mono> cancelAtSubscriptionWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1828,7 +1828,7 @@ private Mono> listSinglePageAsync(Integer top, S new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1879,7 +1879,7 @@ private Mono> listSinglePageAsync(Integer top, S new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2008,7 +2008,7 @@ private Mono> createOrUpdateAtSubscriptionWithRespons } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2060,7 +2060,7 @@ private Mono> createOrUpdateAtSubscriptionWithRespons } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2157,7 +2157,7 @@ private Mono> getAtSubscriptionWithResponseAsync(Stri return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2202,7 +2202,7 @@ private Mono> getAtSubscriptionWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2293,7 +2293,7 @@ private Mono> deleteAtSubscriptionWithResponseAsync(S return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2338,7 +2338,7 @@ private Mono> deleteAtSubscriptionWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2436,7 +2436,7 @@ private Mono> listDeploymentsAtResourc return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2498,7 +2498,7 @@ private Mono> listDeploymentsAtResourc return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2649,7 +2649,7 @@ private Mono> cancelAtResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2700,7 +2700,7 @@ private Mono> cancelAtResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2799,7 +2799,7 @@ private Mono> listByResourceGroupSinglePageAsync return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2857,7 +2857,7 @@ private Mono> listByResourceGroupSinglePageAsync return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3010,7 +3010,7 @@ private Mono> createOrUpdateAtResourceGroupWithRespon } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3068,7 +3068,7 @@ private Mono> createOrUpdateAtResourceGroupWithRespon } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3177,7 +3177,7 @@ private Mono> getByResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3228,7 +3228,7 @@ private Mono> getByResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3329,7 +3329,7 @@ private Mono> deleteWithResponseAsync(String resource return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3380,7 +3380,7 @@ private Mono> deleteWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3476,7 +3476,7 @@ private Mono> listDeploymentsAtResourc return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3524,7 +3524,7 @@ private Mono> listDeploymentsAtResourc return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3660,7 +3660,7 @@ private Mono> cancelAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3698,7 +3698,7 @@ private Mono> cancelAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3783,7 +3783,7 @@ private Mono> listForResourceSinglePageAsync( if (resourceId == null) { return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3827,7 +3827,7 @@ private Mono> listForResourceSinglePageAsync( if (resourceId == null) { return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3965,7 +3965,7 @@ private Mono> createOrUpdateAtResourceWithResponseAsy } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -4015,7 +4015,7 @@ private Mono> createOrUpdateAtResourceWithResponseAsy } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -4108,7 +4108,7 @@ private Mono> getAtResourceWithResponseAsync(String r return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -4146,7 +4146,7 @@ private Mono> getAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -4234,7 +4234,7 @@ private Mono> deleteAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -4272,7 +4272,7 @@ private Mono> deleteAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediation.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediation.java index f9ceb79ac8644..14ea6273b82f0 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediation.java +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediation.java @@ -4,6 +4,9 @@ package com.azure.resourcemanager.policyinsights.models; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; import java.time.OffsetDateTime; @@ -31,6 +34,13 @@ public interface Remediation { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the policyAssignmentId property: The resource ID of the policy assignment that should be remediated. * @@ -89,6 +99,46 @@ public interface Remediation { */ RemediationDeploymentSummary deploymentStatus(); + /** + * Gets the statusMessage property: The remediation status message. Provides additional details regarding the state + * of the remediation. + * + * @return the statusMessage value. + */ + String statusMessage(); + + /** + * Gets the correlationId property: The remediation correlation Id. Can be used to find events related to the + * remediation in the activity log. + * + * @return the correlationId value. + */ + String correlationId(); + + /** + * Gets the resourceCount property: Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * + * @return the resourceCount value. + */ + Integer resourceCount(); + + /** + * Gets the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used + * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is + * used. + * + * @return the parallelDeployments value. + */ + Integer parallelDeployments(); + + /** + * Gets the failureThreshold property: The remediation failure threshold settings. + * + * @return the failureThreshold value. + */ + RemediationPropertiesFailureThreshold failureThreshold(); + /** * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner object. * @@ -123,7 +173,10 @@ interface WithCreate extends DefinitionStages.WithPolicyAssignmentId, DefinitionStages.WithPolicyDefinitionReferenceId, DefinitionStages.WithResourceDiscoveryMode, - DefinitionStages.WithFilters { + DefinitionStages.WithFilters, + DefinitionStages.WithResourceCount, + DefinitionStages.WithParallelDeployments, + DefinitionStages.WithFailureThreshold { /** * Executes the create request. * @@ -187,6 +240,42 @@ interface WithFilters { */ WithCreate withFilters(RemediationFilters filters); } + /** The stage of the Remediation definition allowing to specify resourceCount. */ + interface WithResourceCount { + /** + * Specifies the resourceCount property: Determines the max number of resources that can be remediated by + * the remediation job. If not provided, the default resource count is used.. + * + * @param resourceCount Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * @return the next definition stage. + */ + WithCreate withResourceCount(Integer resourceCount); + } + /** The stage of the Remediation definition allowing to specify parallelDeployments. */ + interface WithParallelDeployments { + /** + * Specifies the parallelDeployments property: Determines how many resources to remediate at any given time. + * Can be used to increase or reduce the pace of the remediation. If not provided, the default parallel + * deployments value is used.. + * + * @param parallelDeployments Determines how many resources to remediate at any given time. Can be used to + * increase or reduce the pace of the remediation. If not provided, the default parallel deployments + * value is used. + * @return the next definition stage. + */ + WithCreate withParallelDeployments(Integer parallelDeployments); + } + /** The stage of the Remediation definition allowing to specify failureThreshold. */ + interface WithFailureThreshold { + /** + * Specifies the failureThreshold property: The remediation failure threshold settings. + * + * @param failureThreshold The remediation failure threshold settings. + * @return the next definition stage. + */ + WithCreate withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold); + } } /** * Begins update for the Remediation resource. @@ -200,7 +289,10 @@ interface Update extends UpdateStages.WithPolicyAssignmentId, UpdateStages.WithPolicyDefinitionReferenceId, UpdateStages.WithResourceDiscoveryMode, - UpdateStages.WithFilters { + UpdateStages.WithFilters, + UpdateStages.WithResourceCount, + UpdateStages.WithParallelDeployments, + UpdateStages.WithFailureThreshold { /** * Executes the update request. * @@ -266,6 +358,42 @@ interface WithFilters { */ Update withFilters(RemediationFilters filters); } + /** The stage of the Remediation update allowing to specify resourceCount. */ + interface WithResourceCount { + /** + * Specifies the resourceCount property: Determines the max number of resources that can be remediated by + * the remediation job. If not provided, the default resource count is used.. + * + * @param resourceCount Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * @return the next definition stage. + */ + Update withResourceCount(Integer resourceCount); + } + /** The stage of the Remediation update allowing to specify parallelDeployments. */ + interface WithParallelDeployments { + /** + * Specifies the parallelDeployments property: Determines how many resources to remediate at any given time. + * Can be used to increase or reduce the pace of the remediation. If not provided, the default parallel + * deployments value is used.. + * + * @param parallelDeployments Determines how many resources to remediate at any given time. Can be used to + * increase or reduce the pace of the remediation. If not provided, the default parallel deployments + * value is used. + * @return the next definition stage. + */ + Update withParallelDeployments(Integer parallelDeployments); + } + /** The stage of the Remediation update allowing to specify failureThreshold. */ + interface WithFailureThreshold { + /** + * Specifies the failureThreshold property: The remediation failure threshold settings. + * + * @param failureThreshold The remediation failure threshold settings. + * @return the next definition stage. + */ + Update withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold); + } } /** * Refreshes the resource to sync with Azure. @@ -281,4 +409,45 @@ interface WithFilters { * @return the refreshed resource. */ Remediation refresh(Context context); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all deployments for a remediation at resource group scope. + */ + PagedIterable listDeploymentsAtResourceGroup(); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all deployments for a remediation at resource group scope. + */ + PagedIterable listDeploymentsAtResourceGroup(Integer top, Context context); + + /** + * Cancels a remediation at resource group scope. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation cancelAtResourceGroup(); + + /** + * Cancels a remediation at resource group scope. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response cancelAtResourceGroupWithResponse(Context context); } diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationPropertiesFailureThreshold.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationPropertiesFailureThreshold.java new file mode 100644 index 0000000000000..4c64f6d798a80 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationPropertiesFailureThreshold.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The remediation failure threshold settings. */ +@Fluent +public final class RemediationPropertiesFailureThreshold { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationPropertiesFailureThreshold.class); + + /* + * A number between 0.0 to 1.0 representing the percentage failure + * threshold. The remediation will fail if the percentage of failed + * remediation operations (i.e. failed deployments) exceeds this threshold. + */ + @JsonProperty(value = "percentage") + private Float percentage; + + /** + * Get the percentage property: A number between 0.0 to 1.0 representing the percentage failure threshold. The + * remediation will fail if the percentage of failed remediation operations (i.e. failed deployments) exceeds this + * threshold. + * + * @return the percentage value. + */ + public Float percentage() { + return this.percentage; + } + + /** + * Set the percentage property: A number between 0.0 to 1.0 representing the percentage failure threshold. The + * remediation will fail if the percentage of failed remediation operations (i.e. failed deployments) exceeds this + * threshold. + * + * @param percentage the percentage value to set. + * @return the RemediationPropertiesFailureThreshold object itself. + */ + public RemediationPropertiesFailureThreshold withPercentage(Float percentage) { + this.percentage = percentage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +}