From acc687a6e7750316d0bf7c9c7979d0775f05ad79 Mon Sep 17 00:00:00 2001 From: gcolom Date: Wed, 25 May 2022 21:19:18 +0200 Subject: [PATCH 1/2] feat: add pagination to Costmanagement Query API --- .../costmanagement/fluent/QueriesClient.java | 18 ++++- .../implementation/QueriesClientImpl.java | 65 +++++++++++++++---- .../implementation/QueriesImpl.java | 14 ++-- .../costmanagement/models/Queries.java | 18 ++++- ...ageByExternalCloudProviderTypeSamples.java | 2 + .../costmanagement/QueryUsageSamples.java | 20 ++++++ 6 files changed, 114 insertions(+), 23 deletions(-) diff --git a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/fluent/QueriesClient.java b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/fluent/QueriesClient.java index 3a3ee85f63cc..baec349c9845 100644 --- a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/fluent/QueriesClient.java +++ b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/fluent/QueriesClient.java @@ -32,6 +32,9 @@ public interface QueriesClient { * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -39,7 +42,7 @@ public interface QueriesClient { * @return result of query. */ @ServiceMethod(returns = ReturnType.SINGLE) - QueryResultInner usage(String scope, QueryDefinition parameters); + QueryResultInner usage(String scope, String skiptoken, QueryDefinition parameters); /** * Query the usage data for scope defined. @@ -59,6 +62,9 @@ public interface QueriesClient { * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -67,7 +73,7 @@ public interface QueriesClient { * @return result of query. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response usageWithResponse(String scope, QueryDefinition parameters, Context context); + Response usageWithResponse(String scope, String skiptoken, QueryDefinition parameters, Context context); /** * Query the usage data for external cloud provider type defined. @@ -77,6 +83,9 @@ public interface QueriesClient { * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -87,6 +96,7 @@ public interface QueriesClient { QueryResultInner usageByExternalCloudProviderType( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters); /** @@ -97,6 +107,9 @@ QueryResultInner usageByExternalCloudProviderType( * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -108,6 +121,7 @@ QueryResultInner usageByExternalCloudProviderType( Response usageByExternalCloudProviderTypeWithResponse( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters, Context context); } diff --git a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/QueriesClientImpl.java b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/QueriesClientImpl.java index 89720476e6d1..0b465096c792 100644 --- a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/QueriesClientImpl.java +++ b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/QueriesClientImpl.java @@ -64,6 +64,7 @@ Mono> usage( @HostParam("$host") String endpoint, @PathParam(value = "scope", encoded = true) String scope, @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skiptoken, @BodyParam("application/json") QueryDefinition parameters, @HeaderParam("Accept") String accept, Context context); @@ -77,6 +78,7 @@ Mono> usageByExternalCloudProviderType( @PathParam("externalCloudProviderType") ExternalCloudProviderType externalCloudProviderType, @PathParam("externalCloudProviderId") String externalCloudProviderId, @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skiptoken, @BodyParam("application/json") QueryDefinition parameters, @HeaderParam("Accept") String accept, Context context); @@ -100,6 +102,9 @@ Mono> usageByExternalCloudProviderType( * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -107,7 +112,7 @@ Mono> usageByExternalCloudProviderType( * @return result of query. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> usageWithResponseAsync(String scope, QueryDefinition parameters) { + private Mono> usageWithResponseAsync(String scope, String skiptoken, QueryDefinition parameters) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -128,7 +133,7 @@ private Mono> usageWithResponseAsync(String scope, Qu context -> service .usage( - this.client.getEndpoint(), scope, this.client.getApiVersion(), parameters, accept, context)) + this.client.getEndpoint(), scope, this.client.getApiVersion(), skiptoken, parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -150,6 +155,9 @@ private Mono> usageWithResponseAsync(String scope, Qu * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -159,7 +167,7 @@ private Mono> usageWithResponseAsync(String scope, Qu */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> usageWithResponseAsync( - String scope, QueryDefinition parameters, Context context) { + String scope, String skiptoken, QueryDefinition parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -177,7 +185,7 @@ private Mono> usageWithResponseAsync( final String accept = "application/json"; context = this.client.mergeContext(context); return service - .usage(this.client.getEndpoint(), scope, this.client.getApiVersion(), parameters, accept, context); + .usage(this.client.getEndpoint(), scope, this.client.getApiVersion(), skiptoken, parameters, accept, context); } /** @@ -198,6 +206,9 @@ private Mono> usageWithResponseAsync( * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -205,8 +216,8 @@ private Mono> usageWithResponseAsync( * @return result of query. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono usageAsync(String scope, QueryDefinition parameters) { - return usageWithResponseAsync(scope, parameters) + private Mono usageAsync(String scope, String skiptoken, QueryDefinition parameters) { + return usageWithResponseAsync(scope, skiptoken, parameters) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -235,6 +246,9 @@ private Mono usageAsync(String scope, QueryDefinition paramete * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -242,8 +256,8 @@ private Mono usageAsync(String scope, QueryDefinition paramete * @return result of query. */ @ServiceMethod(returns = ReturnType.SINGLE) - public QueryResultInner usage(String scope, QueryDefinition parameters) { - return usageAsync(scope, parameters).block(); + public QueryResultInner usage(String scope, String skiptoken, QueryDefinition parameters) { + return usageAsync(scope, skiptoken, parameters).block(); } /** @@ -264,6 +278,9 @@ public QueryResultInner usage(String scope, QueryDefinition parameters) { * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -272,8 +289,8 @@ public QueryResultInner usage(String scope, QueryDefinition parameters) { * @return result of query. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response usageWithResponse(String scope, QueryDefinition parameters, Context context) { - return usageWithResponseAsync(scope, parameters, context).block(); + public Response usageWithResponse(String scope, String skiptoken, QueryDefinition parameters, Context context) { + return usageWithResponseAsync(scope, skiptoken, parameters, context).block(); } /** @@ -284,6 +301,9 @@ public Response usageWithResponse(String scope, QueryDefinitio * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -294,6 +314,7 @@ public Response usageWithResponse(String scope, QueryDefinitio private Mono> usageByExternalCloudProviderTypeWithResponseAsync( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters) { if (this.client.getEndpoint() == null) { return Mono @@ -326,6 +347,7 @@ private Mono> usageByExternalCloudProviderTypeWithRes this.client.getEndpoint(), externalCloudProviderType, externalCloudProviderId, + skiptoken, this.client.getApiVersion(), parameters, accept, @@ -341,6 +363,9 @@ private Mono> usageByExternalCloudProviderTypeWithRes * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -352,6 +377,7 @@ private Mono> usageByExternalCloudProviderTypeWithRes private Mono> usageByExternalCloudProviderTypeWithResponseAsync( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters, Context context) { if (this.client.getEndpoint() == null) { @@ -383,6 +409,7 @@ private Mono> usageByExternalCloudProviderTypeWithRes this.client.getEndpoint(), externalCloudProviderType, externalCloudProviderId, + skiptoken, this.client.getApiVersion(), parameters, accept, @@ -397,6 +424,9 @@ private Mono> usageByExternalCloudProviderTypeWithRes * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -407,9 +437,10 @@ private Mono> usageByExternalCloudProviderTypeWithRes private Mono usageByExternalCloudProviderTypeAsync( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters) { return usageByExternalCloudProviderTypeWithResponseAsync( - externalCloudProviderType, externalCloudProviderId, parameters) + externalCloudProviderType, externalCloudProviderId, skiptoken, parameters) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -428,6 +459,9 @@ private Mono usageByExternalCloudProviderTypeAsync( * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -438,8 +472,9 @@ private Mono usageByExternalCloudProviderTypeAsync( public QueryResultInner usageByExternalCloudProviderType( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters) { - return usageByExternalCloudProviderTypeAsync(externalCloudProviderType, externalCloudProviderId, parameters) + return usageByExternalCloudProviderTypeAsync(externalCloudProviderType, externalCloudProviderId, skiptoken, parameters) .block(); } @@ -451,6 +486,9 @@ public QueryResultInner usageByExternalCloudProviderType( * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -462,10 +500,11 @@ public QueryResultInner usageByExternalCloudProviderType( public Response usageByExternalCloudProviderTypeWithResponse( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters, Context context) { return usageByExternalCloudProviderTypeWithResponseAsync( - externalCloudProviderType, externalCloudProviderId, parameters, context) + externalCloudProviderType, externalCloudProviderId, skiptoken, parameters, context) .block(); } } diff --git a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/QueriesImpl.java b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/QueriesImpl.java index 34af225c3c0d..a106b4a03b1f 100644 --- a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/QueriesImpl.java +++ b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/QueriesImpl.java @@ -29,8 +29,8 @@ public QueriesImpl( this.serviceManager = serviceManager; } - public QueryResult usage(String scope, QueryDefinition parameters) { - QueryResultInner inner = this.serviceClient().usage(scope, parameters); + public QueryResult usage(String scope, String skiptoken, QueryDefinition parameters) { + QueryResultInner inner = this.serviceClient().usage(scope, skiptoken, parameters); if (inner != null) { return new QueryResultImpl(inner, this.manager()); } else { @@ -38,8 +38,8 @@ public QueryResult usage(String scope, QueryDefinition parameters) { } } - public Response usageWithResponse(String scope, QueryDefinition parameters, Context context) { - Response inner = this.serviceClient().usageWithResponse(scope, parameters, context); + public Response usageWithResponse(String scope, String skiptoken, QueryDefinition parameters, Context context) { + Response inner = this.serviceClient().usageWithResponse(scope, skiptoken, parameters, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), @@ -54,11 +54,12 @@ public Response usageWithResponse(String scope, QueryDefinition par public QueryResult usageByExternalCloudProviderType( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters) { QueryResultInner inner = this .serviceClient() - .usageByExternalCloudProviderType(externalCloudProviderType, externalCloudProviderId, parameters); + .usageByExternalCloudProviderType(externalCloudProviderType, externalCloudProviderId, skiptoken, parameters); if (inner != null) { return new QueryResultImpl(inner, this.manager()); } else { @@ -69,13 +70,14 @@ public QueryResult usageByExternalCloudProviderType( public Response usageByExternalCloudProviderTypeWithResponse( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters, Context context) { Response inner = this .serviceClient() .usageByExternalCloudProviderTypeWithResponse( - externalCloudProviderType, externalCloudProviderId, parameters, context); + externalCloudProviderType, externalCloudProviderId, skiptoken, parameters, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), diff --git a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/models/Queries.java b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/models/Queries.java index fe787d7a87a9..8812d8eeedba 100644 --- a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/models/Queries.java +++ b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/models/Queries.java @@ -27,13 +27,16 @@ public interface Queries { * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config 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 result of query. */ - QueryResult usage(String scope, QueryDefinition parameters); + QueryResult usage(String scope, String skiptoken, QueryDefinition parameters); /** * Query the usage data for scope defined. @@ -53,6 +56,9 @@ public interface Queries { * for invoiceSection scope, and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -60,7 +66,7 @@ public interface Queries { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of query. */ - Response usageWithResponse(String scope, QueryDefinition parameters, Context context); + Response usageWithResponse(String scope, String skiptoken, QueryDefinition parameters, Context context); /** * Query the usage data for external cloud provider type defined. @@ -70,6 +76,9 @@ public interface Queries { * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -79,6 +88,7 @@ public interface Queries { QueryResult usageByExternalCloudProviderType( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters); /** @@ -89,6 +99,9 @@ QueryResult usageByExternalCloudProviderType( * account. * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -99,6 +112,7 @@ QueryResult usageByExternalCloudProviderType( Response usageByExternalCloudProviderTypeWithResponse( ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, + String skiptoken, QueryDefinition parameters, Context context); } diff --git a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageByExternalCloudProviderTypeSamples.java b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageByExternalCloudProviderTypeSamples.java index b71cdc6e45ca..8ce568a52c5e 100644 --- a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageByExternalCloudProviderTypeSamples.java +++ b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageByExternalCloudProviderTypeSamples.java @@ -30,6 +30,7 @@ public static void externalSubscriptionsQuery( .usageByExternalCloudProviderTypeWithResponse( ExternalCloudProviderType.EXTERNAL_SUBSCRIPTIONS, "100", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -81,6 +82,7 @@ public static void externalBillingAccountQueryList( .usageByExternalCloudProviderTypeWithResponse( ExternalCloudProviderType.EXTERNAL_BILLING_ACCOUNTS, "100", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) diff --git a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageSamples.java b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageSamples.java index 41d69df040f0..acfcae723164 100644 --- a/sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageSamples.java +++ b/sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageSamples.java @@ -34,6 +34,7 @@ public static void customerQueryGroupingModern( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -64,6 +65,7 @@ public static void invoiceSectionQueryModern( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -114,6 +116,7 @@ public static void subscriptionQueryGroupingLegacy( .queries() .usageWithResponse( "subscriptions/00000000-0000-0000-0000-000000000000", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -144,6 +147,7 @@ public static void billingAccountQueryGroupingModern( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/12345:6789", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -174,6 +178,7 @@ public static void enrollmentAccountQueryGroupingLegacy( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -204,6 +209,7 @@ public static void customerQueryModern( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -254,6 +260,7 @@ public static void billingAccountQueryModern( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/12345:6789", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -304,6 +311,7 @@ public static void departmentQueryLegacy( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/100/departments/123", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -354,6 +362,7 @@ public static void billingAccountQueryGroupingLegacy( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/70664866", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -384,6 +393,7 @@ public static void subscriptionQueryLegacy( .queries() .usageWithResponse( "subscriptions/00000000-0000-0000-0000-000000000000", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -434,6 +444,7 @@ public static void enrollmentAccountQueryLegacy( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -484,6 +495,7 @@ public static void billingProfileQueryModern( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -534,6 +546,7 @@ public static void resourceGroupQueryGroupingLegacy( .queries() .usageWithResponse( "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -564,6 +577,7 @@ public static void billingAccountQueryLegacy( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/70664866", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -614,6 +628,7 @@ public static void resourceGroupQueryLegacy( .queries() .usageWithResponse( "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -664,6 +679,7 @@ public static void managementGroupQueryLegacy( .queries() .usageWithResponse( "providers/Microsoft.Management/managementGroups/MyMgId", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) @@ -714,6 +730,7 @@ public static void departmentQueryGroupingLegacy( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/100/departments/123", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -744,6 +761,7 @@ public static void invoiceSectionQueryGroupingModern( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -774,6 +792,7 @@ public static void billingProfileQueryGroupingModern( .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) @@ -804,6 +823,7 @@ public static void managementGroupQueryGroupingLegacy( .queries() .usageWithResponse( "providers/Microsoft.Management/managementGroups/MyMgId", + null, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.THE_LAST_MONTH) From 50078945d21f60883e26f54e7cecb32588e078bc Mon Sep 17 00:00:00 2001 From: gcolom Date: Fri, 10 Jun 2022 15:38:27 +0200 Subject: [PATCH 2/2] docs: modify changelog --- .../CHANGELOG.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sdk/costmanagement/azure-resourcemanager-costmanagement/CHANGELOG.md b/sdk/costmanagement/azure-resourcemanager-costmanagement/CHANGELOG.md index 2c4cd76b8547..76804d765b60 100644 --- a/sdk/costmanagement/azure-resourcemanager-costmanagement/CHANGELOG.md +++ b/sdk/costmanagement/azure-resourcemanager-costmanagement/CHANGELOG.md @@ -2,6 +2,26 @@ ## 1.0.0-beta.4 (Unreleased) +### Breaking Changes + +#### `models.Queries` was modified + +* `usage(java.lang.String, com.azure.resourcemanager.costmanagement.models.QueryDefinition)` was removed + +* `usageWithResponse(java.lang.String, com.azure.resourcemanager.costmanagement.models.QueryDefinition, com.azure.core.util.Context)` was removed + +* `usageByExternalCloudProviderType(com.azure.resourcemanager.costmanagement.models.ExternalCloudProviderType, java.lang.String, com.azure.resourcemanager.costmanagement.models.QueryDefinition)` was removed + +* `usageByExternalCloudProviderTypeWithResponse(com.azure.resourcemanager.costmanagement.models.ExternalCloudProviderType, java.lang.String, com.azure.resourcemanager.costmanagement.models.QueryDefinition,com.azure.core.util.Context)` was removed + +* `usage(java.lang.String, java.lang.String, com.azure.resourcemanager.costmanagement.models.QueryDefinition)` was added + +* `usageWithResponse(java.lang.String, java.lang.String, com.azure.resourcemanager.costmanagement.models.QueryDefinition, com.azure.core.util.Context)` was added + +* `usageByExternalCloudProviderType(com.azure.resourcemanager.costmanagement.models.ExternalCloudProviderType, java.lang.String, java.lang.String, com.azure.resourcemanager.costmanagement.models.QueryDefinition)` was added + +* `usageByExternalCloudProviderTypeWithResponse(com.azure.resourcemanager.costmanagement.models.ExternalCloudProviderType, java.lang.String, java.lang.String, com.azure.resourcemanager.costmanagement.models.QueryDefinition,com.azure.core.util.Context)` was added + ## 1.0.0-beta.3 (2021-07-29)