From b1230f72cbf5cb691d75f59b3420e04d5ee1d7d0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 16 Jul 2021 08:38:59 +0000 Subject: [PATCH] CodeGen from PR 14035 in Azure/azure-rest-api-specs Fix to support nextLink with post calls for python sdk (#14035) * single example with post nextLinl * address suggestions * remove examples * Add nextLink param * Post on nextLink for all requests * Add api-version as param * update readme * prettier fix * fix lint err try * rename operation id * fix generation for python * fix casing of next link * Remove package * change one next link op to normal path * readme.python config * Update readme.python.md Co-authored-by: Namrata Jagasia Co-authored-by: iscai-msft Co-authored-by: Zed <601306339@qq.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> --- .../CHANGELOG.md | 3 +- .../README.md | 4 +- .../pom.xml | 141 ++-- .../policyinsights/PolicyInsightsManager.java | 22 +- .../PolicyEventsClientImpl.java | 696 ++---------------- .../PolicyStatesClientImpl.java | 696 ++---------------- .../implementation/RemediationImpl.java | 23 + .../policyinsights/models/Remediation.java | 43 ++ 8 files changed, 258 insertions(+), 1370 deletions(-) diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md b/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md index f0a34565a57a0..ae88d2ba4b8ec 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-07-16) +- 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). ## 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..64ac9313d401f 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md @@ -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 0b5507cfd216a..8bc04f55eafaa 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-01. + 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.18.0 - - - com.azure - azure-core-management - 1.3.1 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.5 - - 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.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + 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/implementation/PolicyEventsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java index 1292534dc8985..fc9926d9553e1 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 @@ -5,7 +5,6 @@ package com.azure.resourcemanager.policyinsights.implementation; import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; @@ -252,82 +251,14 @@ Mono> listQueryResultsForResourceGroupLevelPo Context context); @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") + @Post("/{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, + Mono> nextLink( @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForResourceGroupLevelPolicyAssignmentNext( + @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skipToken, @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } @@ -526,7 +457,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -552,7 +483,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync(Stri () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -594,7 +525,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken, context), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -849,7 +780,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -875,7 +806,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync(String () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -917,7 +848,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -1188,7 +1119,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( () -> listQueryResultsForResourceGroupSinglePageAsync( subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1216,7 +1147,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( () -> listQueryResultsForResourceGroupSinglePageAsync( subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1270,7 +1201,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -1537,7 +1468,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1564,7 +1495,7 @@ private PagedFlux listQueryResultsForResourceAsync(String reso () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1608,7 +1539,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken, context), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -1888,7 +1819,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( () -> listQueryResultsForPolicySetDefinitionSinglePageAsync( subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1916,7 +1847,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( () -> listQueryResultsForPolicySetDefinitionSinglePageAsync( subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1970,7 +1901,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -2259,7 +2190,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( () -> listQueryResultsForPolicyDefinitionSinglePageAsync( subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -2287,7 +2218,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( () -> listQueryResultsForPolicyDefinitionSinglePageAsync( subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -2341,7 +2272,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -2630,7 +2561,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs () -> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -2658,7 +2589,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs () -> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -2712,7 +2643,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -3027,7 +2958,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -3066,7 +2997,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -3123,7 +3054,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -3219,122 +3150,46 @@ public PagedIterable listQueryResultsForResourceGroupLevelPoli } /** - * 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> 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. + * Subsequent post calls to the next link. * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. + * @param nextLink Next link for list operation. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. * @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.")); - } + private Mono> nextLinkSinglePageAsync(String nextLink, String skipToken) { 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 apiVersion = "2019-10-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> - service.listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + service.nextLink(this.client.getEndpoint(), apiVersion, skipToken, nextLink, accept, context)) .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get the next page of items. + * Subsequent post calls to the next link. * - * @param nextLink The nextLink parameter. + * @param nextLink Next link for list operation. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. * @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. @@ -3342,486 +3197,25 @@ private Mono> listQueryResultsForSubscriptionNex * @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) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } + private Mono> nextLinkSinglePageAsync( + String nextLink, String skipToken, Context context) { 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)) - .>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> 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 apiVersion = "2019-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .nextLink(this.client.getEndpoint(), apiVersion, skipToken, nextLink, 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) { - 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) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } } 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..d6bcd8366dca8 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 @@ -5,7 +5,6 @@ package com.azure.resourcemanager.policyinsights.implementation; import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; @@ -442,82 +441,14 @@ Mono> summarizeForResourceGroupLevelPolicyAssign Context context); @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") + @Post("/{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, + Mono> nextLink( @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listQueryResultsForResourceGroupLevelPolicyAssignmentNext( + @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skipToken, @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } @@ -740,7 +671,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -778,7 +709,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -833,7 +764,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -1325,7 +1256,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1354,7 +1285,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1409,7 +1340,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -1910,7 +1841,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -1950,7 +1881,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -2008,7 +1939,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -2546,7 +2477,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -2576,7 +2507,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -2634,7 +2565,7 @@ private PagedFlux listQueryResultsForResourceAsync( expand, skipToken, context), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -3544,7 +3475,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -3584,7 +3515,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -3642,7 +3573,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -4212,7 +4143,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -4252,7 +4183,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -4310,7 +4241,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -4876,7 +4807,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -4916,7 +4847,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -4974,7 +4905,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -5560,7 +5491,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -5605,7 +5536,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken)); } /** @@ -5666,7 +5597,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, skipToken, context)); } /** @@ -6031,122 +5962,46 @@ public Response summarizeForResourceGroupLevelPolicyAssig } /** - * 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> 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. + * Subsequent post calls to the next link. * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. + * @param nextLink Next link for list operation. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. * @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.")); - } + private Mono> nextLinkSinglePageAsync(String nextLink, String skipToken) { 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 apiVersion = "2019-10-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> - service.listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + service.nextLink(this.client.getEndpoint(), apiVersion, skipToken, nextLink, accept, context)) .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get the next page of items. + * Subsequent post calls to the next link. * - * @param nextLink The nextLink parameter. + * @param nextLink Next link for list operation. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. * @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. @@ -6154,486 +6009,25 @@ private Mono> listQueryResultsForSubscriptionNex * @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) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } + private Mono> nextLinkSinglePageAsync( + String nextLink, String skipToken, Context context) { 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)) - .>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> 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 apiVersion = "2019-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .nextLink(this.client.getEndpoint(), apiVersion, skipToken, nextLink, 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) { - 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) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().odataNextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } } 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..273704fb82215 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,9 +4,12 @@ package com.azure.resourcemanager.policyinsights.implementation; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; 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.ResourceDiscoveryMode; @@ -160,6 +163,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; 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..f2e8c185cb61d 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,8 @@ package com.azure.resourcemanager.policyinsights.models; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; import java.time.OffsetDateTime; @@ -281,4 +283,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); }