diff --git a/sdk/commerce/azure-resourcemanager-commerce/CHANGELOG.md b/sdk/commerce/azure-resourcemanager-commerce/CHANGELOG.md index f98bc1b9712a..bba89173027b 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/CHANGELOG.md +++ b/sdk/commerce/azure-resourcemanager-commerce/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2022-06-02) +- Azure Resource Manager Usage client library for Java. This package contains Microsoft Azure SDK for Usage Management SDK. Package tag package-2015-06-preview. 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-13) diff --git a/sdk/commerce/azure-resourcemanager-commerce/README.md b/sdk/commerce/azure-resourcemanager-commerce/README.md index 4d39d5f1dc28..6c2ad86ecee8 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/README.md +++ b/sdk/commerce/azure-resourcemanager-commerce/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-commerce - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,9 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/commerce/azure-resourcemanager-commerce/SAMPLE.md) + + ## Troubleshooting ## Next steps diff --git a/sdk/commerce/azure-resourcemanager-commerce/SAMPLE.md b/sdk/commerce/azure-resourcemanager-commerce/SAMPLE.md new file mode 100644 index 000000000000..da3099f5db6c --- /dev/null +++ b/sdk/commerce/azure-resourcemanager-commerce/SAMPLE.md @@ -0,0 +1,31 @@ +# Code snippets and samples + + +## RateCard + +- [Get](#ratecard_get) +### RateCard_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RateCard Get. */ +public final class RateCardGetSamples { + /* + * x-ms-original-file: specification/commerce/resource-manager/Microsoft.Commerce/preview/2015-06-01-preview/examples/GetRateCard.json + */ + /** + * Sample code: GetRateCard. + * + * @param manager Entry point to UsageManager. + */ + public static void getRateCard(com.azure.resourcemanager.commerce.UsageManager manager) { + manager + .rateCards() + .getWithResponse( + "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'", + Context.NONE); + } +} +``` + diff --git a/sdk/commerce/azure-resourcemanager-commerce/pom.xml b/sdk/commerce/azure-resourcemanager-commerce/pom.xml index 0fea5945ec01..a14cf18e405d 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/pom.xml +++ b/sdk/commerce/azure-resourcemanager-commerce/pom.xml @@ -1,55 +1,55 @@ - 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-commerce - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-commerce + 1.0.0-beta.2 + jar - Microsoft Azure SDK for Usage Management - This package contains Microsoft Azure SDK for Usage Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2015-06-preview. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for Usage Management + This package contains Microsoft Azure SDK for Usage Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2015-06-preview. + 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 - true - - - - com.azure - azure-core - 1.28.0 - - - com.azure - azure-core-management - 1.6.0 - - + + 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 + true + + + + com.azure + azure-core + 1.28.0 + + + com.azure + azure-core-management + 1.6.0 + + diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java index cefee4c355c8..6e9d174c2471 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java @@ -8,15 +8,18 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; 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; @@ -31,6 +34,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** Entry point to UsageManager. */ public final class UsageManager { @@ -65,6 +69,19 @@ public static UsageManager authenticate(TokenCredential credential, AzureProfile return configure().authenticate(credential, profile); } + /** + * Creates an instance of Usage service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Usage service API instance. + */ + public static UsageManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new UsageManager(httpPipeline, profile, null); + } + /** * Gets a Configurable instance that can be used to create UsageManager with optional configuration. * @@ -76,12 +93,14 @@ public static Configurable configure() { /** The Configurable allowing configurations to be set. */ public static final class Configurable { - private final ClientLogger logger = new ClientLogger(Configurable.class); + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; + private RetryOptions retryOptions; private Duration defaultPollInterval; private Configurable() { @@ -120,6 +139,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. * @@ -131,6 +161,19 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { return this; } + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + /** * Sets the default poll interval, used when service does not provide "Retry-After" header. * @@ -138,9 +181,11 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { * @return the configurable object itself. */ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); if (this.defaultPollInterval.isNegative()) { - throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); } return this; } @@ -176,20 +221,38 @@ public UsageManager authenticate(TokenCredential credential, AzureProfile profil userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } } List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); - policies.addAll(this.policies); + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = @@ -201,7 +264,11 @@ public UsageManager authenticate(TokenCredential credential, AzureProfile profil } } - /** @return Resource collection API of UsageAggregates. */ + /** + * Gets the resource collection API of UsageAggregates. + * + * @return Resource collection API of UsageAggregates. + */ public UsageAggregates usageAggregates() { if (this.usageAggregates == null) { this.usageAggregates = new UsageAggregatesImpl(clientObject.getUsageAggregates(), this); @@ -209,7 +276,11 @@ public UsageAggregates usageAggregates() { return usageAggregates; } - /** @return Resource collection API of RateCards. */ + /** + * Gets the resource collection API of RateCards. + * + * @return Resource collection API of RateCards. + */ public RateCards rateCards() { if (this.rateCards == null) { this.rateCards = new RateCardsImpl(clientObject.getRateCards(), this); diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/RateCardsClient.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/RateCardsClient.java index 8463a9589ec9..03ec81c5233b 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/RateCardsClient.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/RateCardsClient.java @@ -46,7 +46,7 @@ public interface RateCardsClient { * @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 price and Metadata information for resources. + * @return price and Metadata information for resources along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse(String filter, Context context); diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/UsageAggregatesClient.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/UsageAggregatesClient.java index 1188d1c881df..4c3d767c5740 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/UsageAggregatesClient.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/UsageAggregatesClient.java @@ -22,7 +22,7 @@ public interface UsageAggregatesClient { * @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 Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(OffsetDateTime reportedStartTime, OffsetDateTime reportedEndTime); @@ -46,7 +46,7 @@ public interface UsageAggregatesClient { * @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 Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list( diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/ResourceRateCardInfoInner.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/ResourceRateCardInfoInner.java index ef7d8c5ef553..41a04f375ade 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/ResourceRateCardInfoInner.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/ResourceRateCardInfoInner.java @@ -5,18 +5,14 @@ package com.azure.resourcemanager.commerce.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.commerce.models.MeterInfo; -import com.azure.resourcemanager.commerce.models.OfferTermInfo; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.azure.resourcemanager.commerce.models.OfferTermInfoAutoGenerated; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** Price and Metadata information for resources. */ @Fluent public final class ResourceRateCardInfoInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceRateCardInfoInner.class); - /* * The currency in which the rates are provided. */ @@ -39,7 +35,7 @@ public final class ResourceRateCardInfoInner { * A list of offer terms. */ @JsonProperty(value = "OfferTerms") - private List offerTerms; + private List offerTerms; /* * A list of meters. @@ -112,7 +108,7 @@ public ResourceRateCardInfoInner withIsTaxIncluded(Boolean isTaxIncluded) { * * @return the offerTerms value. */ - public List offerTerms() { + public List offerTerms() { return this.offerTerms; } @@ -122,7 +118,7 @@ public List offerTerms() { * @param offerTerms the offerTerms value to set. * @return the ResourceRateCardInfoInner object itself. */ - public ResourceRateCardInfoInner withOfferTerms(List offerTerms) { + public ResourceRateCardInfoInner withOfferTerms(List offerTerms) { this.offerTerms = offerTerms; return this; } diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageAggregationInner.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageAggregationInner.java index 8a36a3fcb1c1..8376253e1152 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageAggregationInner.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageAggregationInner.java @@ -5,20 +5,14 @@ package com.azure.resourcemanager.commerce.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.commerce.models.InfoField; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.UUID; /** Describes the usageAggregation. */ -@JsonFlatten @Fluent -public class UsageAggregationInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageAggregationInner.class); - +public final class UsageAggregationInner { /* * Unique Id for the usage aggregate. */ @@ -38,78 +32,10 @@ public class UsageAggregationInner { private String type; /* - * The subscription identifier for the Azure user. - */ - @JsonProperty(value = "properties.subscriptionId") - private UUID subscriptionId; - - /* - * Unique ID for the resource that was consumed (aka ResourceID). - */ - @JsonProperty(value = "properties.meterId") - private String meterId; - - /* - * UTC start time for the usage bucket to which this usage aggregate - * belongs. - */ - @JsonProperty(value = "properties.usageStartTime") - private OffsetDateTime usageStartTime; - - /* - * UTC end time for the usage bucket to which this usage aggregate belongs. - */ - @JsonProperty(value = "properties.usageEndTime") - private OffsetDateTime usageEndTime; - - /* - * The amount of the resource consumption that occurred in this time frame. + * Usage data. */ - @JsonProperty(value = "properties.quantity") - private Float quantity; - - /* - * The unit in which the usage for this resource is being counted, e.g. - * Hours, GB. - */ - @JsonProperty(value = "properties.unit") - private String unit; - - /* - * Friendly name of the resource being consumed. - */ - @JsonProperty(value = "properties.meterName") - private String meterName; - - /* - * Category of the consumed resource. - */ - @JsonProperty(value = "properties.meterCategory") - private String meterCategory; - - /* - * Sub-category of the consumed resource. - */ - @JsonProperty(value = "properties.meterSubCategory") - private String meterSubCategory; - - /* - * Region of the meterId used for billing purposes - */ - @JsonProperty(value = "properties.meterRegion") - private String meterRegion; - - /* - * Key-value pairs of instance details (legacy format). - */ - @JsonProperty(value = "properties.infoFields") - private InfoField infoFields; - - /* - * Key-value pairs of instance details represented as a string. - */ - @JsonProperty(value = "properties.instanceData") - private String instanceData; + @JsonProperty(value = "properties") + private UsageSample innerProperties; /** * Get the id property: Unique Id for the usage aggregate. @@ -171,13 +97,22 @@ public UsageAggregationInner withType(String type) { return this; } + /** + * Get the innerProperties property: Usage data. + * + * @return the innerProperties value. + */ + private UsageSample innerProperties() { + return this.innerProperties; + } + /** * Get the subscriptionId property: The subscription identifier for the Azure user. * * @return the subscriptionId value. */ public UUID subscriptionId() { - return this.subscriptionId; + return this.innerProperties() == null ? null : this.innerProperties().subscriptionId(); } /** @@ -187,7 +122,10 @@ public UUID subscriptionId() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withSubscriptionId(UUID subscriptionId) { - this.subscriptionId = subscriptionId; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withSubscriptionId(subscriptionId); return this; } @@ -197,7 +135,7 @@ public UsageAggregationInner withSubscriptionId(UUID subscriptionId) { * @return the meterId value. */ public String meterId() { - return this.meterId; + return this.innerProperties() == null ? null : this.innerProperties().meterId(); } /** @@ -207,7 +145,10 @@ public String meterId() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withMeterId(String meterId) { - this.meterId = meterId; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withMeterId(meterId); return this; } @@ -217,7 +158,7 @@ public UsageAggregationInner withMeterId(String meterId) { * @return the usageStartTime value. */ public OffsetDateTime usageStartTime() { - return this.usageStartTime; + return this.innerProperties() == null ? null : this.innerProperties().usageStartTime(); } /** @@ -227,7 +168,10 @@ public OffsetDateTime usageStartTime() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withUsageStartTime(OffsetDateTime usageStartTime) { - this.usageStartTime = usageStartTime; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withUsageStartTime(usageStartTime); return this; } @@ -237,7 +181,7 @@ public UsageAggregationInner withUsageStartTime(OffsetDateTime usageStartTime) { * @return the usageEndTime value. */ public OffsetDateTime usageEndTime() { - return this.usageEndTime; + return this.innerProperties() == null ? null : this.innerProperties().usageEndTime(); } /** @@ -247,7 +191,10 @@ public OffsetDateTime usageEndTime() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withUsageEndTime(OffsetDateTime usageEndTime) { - this.usageEndTime = usageEndTime; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withUsageEndTime(usageEndTime); return this; } @@ -257,7 +204,7 @@ public UsageAggregationInner withUsageEndTime(OffsetDateTime usageEndTime) { * @return the quantity value. */ public Float quantity() { - return this.quantity; + return this.innerProperties() == null ? null : this.innerProperties().quantity(); } /** @@ -267,7 +214,10 @@ public Float quantity() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withQuantity(Float quantity) { - this.quantity = quantity; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withQuantity(quantity); return this; } @@ -277,7 +227,7 @@ public UsageAggregationInner withQuantity(Float quantity) { * @return the unit value. */ public String unit() { - return this.unit; + return this.innerProperties() == null ? null : this.innerProperties().unit(); } /** @@ -287,7 +237,10 @@ public String unit() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withUnit(String unit) { - this.unit = unit; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withUnit(unit); return this; } @@ -297,7 +250,7 @@ public UsageAggregationInner withUnit(String unit) { * @return the meterName value. */ public String meterName() { - return this.meterName; + return this.innerProperties() == null ? null : this.innerProperties().meterName(); } /** @@ -307,7 +260,10 @@ public String meterName() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withMeterName(String meterName) { - this.meterName = meterName; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withMeterName(meterName); return this; } @@ -317,7 +273,7 @@ public UsageAggregationInner withMeterName(String meterName) { * @return the meterCategory value. */ public String meterCategory() { - return this.meterCategory; + return this.innerProperties() == null ? null : this.innerProperties().meterCategory(); } /** @@ -327,7 +283,10 @@ public String meterCategory() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withMeterCategory(String meterCategory) { - this.meterCategory = meterCategory; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withMeterCategory(meterCategory); return this; } @@ -337,7 +296,7 @@ public UsageAggregationInner withMeterCategory(String meterCategory) { * @return the meterSubCategory value. */ public String meterSubCategory() { - return this.meterSubCategory; + return this.innerProperties() == null ? null : this.innerProperties().meterSubCategory(); } /** @@ -347,7 +306,10 @@ public String meterSubCategory() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withMeterSubCategory(String meterSubCategory) { - this.meterSubCategory = meterSubCategory; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withMeterSubCategory(meterSubCategory); return this; } @@ -357,7 +319,7 @@ public UsageAggregationInner withMeterSubCategory(String meterSubCategory) { * @return the meterRegion value. */ public String meterRegion() { - return this.meterRegion; + return this.innerProperties() == null ? null : this.innerProperties().meterRegion(); } /** @@ -367,7 +329,10 @@ public String meterRegion() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withMeterRegion(String meterRegion) { - this.meterRegion = meterRegion; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withMeterRegion(meterRegion); return this; } @@ -377,7 +342,7 @@ public UsageAggregationInner withMeterRegion(String meterRegion) { * @return the infoFields value. */ public InfoField infoFields() { - return this.infoFields; + return this.innerProperties() == null ? null : this.innerProperties().infoFields(); } /** @@ -387,7 +352,10 @@ public InfoField infoFields() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withInfoFields(InfoField infoFields) { - this.infoFields = infoFields; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withInfoFields(infoFields); return this; } @@ -397,7 +365,7 @@ public UsageAggregationInner withInfoFields(InfoField infoFields) { * @return the instanceData value. */ public String instanceData() { - return this.instanceData; + return this.innerProperties() == null ? null : this.innerProperties().instanceData(); } /** @@ -407,7 +375,10 @@ public String instanceData() { * @return the UsageAggregationInner object itself. */ public UsageAggregationInner withInstanceData(String instanceData) { - this.instanceData = instanceData; + if (this.innerProperties() == null) { + this.innerProperties = new UsageSample(); + } + this.innerProperties().withInstanceData(instanceData); return this; } @@ -417,8 +388,8 @@ public UsageAggregationInner withInstanceData(String instanceData) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (infoFields() != null) { - infoFields().validate(); + if (innerProperties() != null) { + innerProperties().validate(); } } } diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageSample.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageSample.java new file mode 100644 index 000000000000..ebf452b0a41a --- /dev/null +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageSample.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.commerce.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.commerce.models.InfoField; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Describes a sample of the usageAggregation. */ +@Fluent +public final class UsageSample { + /* + * The subscription identifier for the Azure user. + */ + @JsonProperty(value = "subscriptionId") + private UUID subscriptionId; + + /* + * Unique ID for the resource that was consumed (aka ResourceID). + */ + @JsonProperty(value = "meterId") + private String meterId; + + /* + * UTC start time for the usage bucket to which this usage aggregate + * belongs. + */ + @JsonProperty(value = "usageStartTime") + private OffsetDateTime usageStartTime; + + /* + * UTC end time for the usage bucket to which this usage aggregate belongs. + */ + @JsonProperty(value = "usageEndTime") + private OffsetDateTime usageEndTime; + + /* + * The amount of the resource consumption that occurred in this time frame. + */ + @JsonProperty(value = "quantity") + private Float quantity; + + /* + * The unit in which the usage for this resource is being counted, e.g. + * Hours, GB. + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * Friendly name of the resource being consumed. + */ + @JsonProperty(value = "meterName") + private String meterName; + + /* + * Category of the consumed resource. + */ + @JsonProperty(value = "meterCategory") + private String meterCategory; + + /* + * Sub-category of the consumed resource. + */ + @JsonProperty(value = "meterSubCategory") + private String meterSubCategory; + + /* + * Region of the meterId used for billing purposes + */ + @JsonProperty(value = "meterRegion") + private String meterRegion; + + /* + * Key-value pairs of instance details (legacy format). + */ + @JsonProperty(value = "infoFields") + private InfoField infoFields; + + /* + * Key-value pairs of instance details represented as a string. + */ + @JsonProperty(value = "instanceData") + private String instanceData; + + /** + * Get the subscriptionId property: The subscription identifier for the Azure user. + * + * @return the subscriptionId value. + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription identifier for the Azure user. + * + * @param subscriptionId the subscriptionId value to set. + * @return the UsageSample object itself. + */ + public UsageSample withSubscriptionId(UUID subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the meterId property: Unique ID for the resource that was consumed (aka ResourceID). + * + * @return the meterId value. + */ + public String meterId() { + return this.meterId; + } + + /** + * Set the meterId property: Unique ID for the resource that was consumed (aka ResourceID). + * + * @param meterId the meterId value to set. + * @return the UsageSample object itself. + */ + public UsageSample withMeterId(String meterId) { + this.meterId = meterId; + return this; + } + + /** + * Get the usageStartTime property: UTC start time for the usage bucket to which this usage aggregate belongs. + * + * @return the usageStartTime value. + */ + public OffsetDateTime usageStartTime() { + return this.usageStartTime; + } + + /** + * Set the usageStartTime property: UTC start time for the usage bucket to which this usage aggregate belongs. + * + * @param usageStartTime the usageStartTime value to set. + * @return the UsageSample object itself. + */ + public UsageSample withUsageStartTime(OffsetDateTime usageStartTime) { + this.usageStartTime = usageStartTime; + return this; + } + + /** + * Get the usageEndTime property: UTC end time for the usage bucket to which this usage aggregate belongs. + * + * @return the usageEndTime value. + */ + public OffsetDateTime usageEndTime() { + return this.usageEndTime; + } + + /** + * Set the usageEndTime property: UTC end time for the usage bucket to which this usage aggregate belongs. + * + * @param usageEndTime the usageEndTime value to set. + * @return the UsageSample object itself. + */ + public UsageSample withUsageEndTime(OffsetDateTime usageEndTime) { + this.usageEndTime = usageEndTime; + return this; + } + + /** + * Get the quantity property: The amount of the resource consumption that occurred in this time frame. + * + * @return the quantity value. + */ + public Float quantity() { + return this.quantity; + } + + /** + * Set the quantity property: The amount of the resource consumption that occurred in this time frame. + * + * @param quantity the quantity value to set. + * @return the UsageSample object itself. + */ + public UsageSample withQuantity(Float quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the unit property: The unit in which the usage for this resource is being counted, e.g. Hours, GB. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: The unit in which the usage for this resource is being counted, e.g. Hours, GB. + * + * @param unit the unit value to set. + * @return the UsageSample object itself. + */ + public UsageSample withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the meterName property: Friendly name of the resource being consumed. + * + * @return the meterName value. + */ + public String meterName() { + return this.meterName; + } + + /** + * Set the meterName property: Friendly name of the resource being consumed. + * + * @param meterName the meterName value to set. + * @return the UsageSample object itself. + */ + public UsageSample withMeterName(String meterName) { + this.meterName = meterName; + return this; + } + + /** + * Get the meterCategory property: Category of the consumed resource. + * + * @return the meterCategory value. + */ + public String meterCategory() { + return this.meterCategory; + } + + /** + * Set the meterCategory property: Category of the consumed resource. + * + * @param meterCategory the meterCategory value to set. + * @return the UsageSample object itself. + */ + public UsageSample withMeterCategory(String meterCategory) { + this.meterCategory = meterCategory; + return this; + } + + /** + * Get the meterSubCategory property: Sub-category of the consumed resource. + * + * @return the meterSubCategory value. + */ + public String meterSubCategory() { + return this.meterSubCategory; + } + + /** + * Set the meterSubCategory property: Sub-category of the consumed resource. + * + * @param meterSubCategory the meterSubCategory value to set. + * @return the UsageSample object itself. + */ + public UsageSample withMeterSubCategory(String meterSubCategory) { + this.meterSubCategory = meterSubCategory; + return this; + } + + /** + * Get the meterRegion property: Region of the meterId used for billing purposes. + * + * @return the meterRegion value. + */ + public String meterRegion() { + return this.meterRegion; + } + + /** + * Set the meterRegion property: Region of the meterId used for billing purposes. + * + * @param meterRegion the meterRegion value to set. + * @return the UsageSample object itself. + */ + public UsageSample withMeterRegion(String meterRegion) { + this.meterRegion = meterRegion; + return this; + } + + /** + * Get the infoFields property: Key-value pairs of instance details (legacy format). + * + * @return the infoFields value. + */ + public InfoField infoFields() { + return this.infoFields; + } + + /** + * Set the infoFields property: Key-value pairs of instance details (legacy format). + * + * @param infoFields the infoFields value to set. + * @return the UsageSample object itself. + */ + public UsageSample withInfoFields(InfoField infoFields) { + this.infoFields = infoFields; + return this; + } + + /** + * Get the instanceData property: Key-value pairs of instance details represented as a string. + * + * @return the instanceData value. + */ + public String instanceData() { + return this.instanceData; + } + + /** + * Set the instanceData property: Key-value pairs of instance details represented as a string. + * + * @param instanceData the instanceData value to set. + * @return the UsageSample object itself. + */ + public UsageSample withInstanceData(String instanceData) { + this.instanceData = instanceData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (infoFields() != null) { + infoFields().validate(); + } + } +} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsClientImpl.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsClientImpl.java index ab0122223ba8..4b384c67c7cd 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsClientImpl.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsClientImpl.java @@ -21,15 +21,12 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.commerce.fluent.RateCardsClient; import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in RateCardsClient. */ public final class RateCardsClientImpl implements RateCardsClient { - private final ClientLogger logger = new ClientLogger(RateCardsClientImpl.class); - /** The proxy service used to perform REST calls. */ private final RateCardsService service; @@ -81,7 +78,8 @@ Mono> get( * @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 price and Metadata information for resources. + * @return price and Metadata information for resources along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String filter) { @@ -130,7 +128,8 @@ private Mono> getWithResponseAsync(String fi * @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 price and Metadata information for resources. + * @return price and Metadata information for resources along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String filter, Context context) { @@ -175,19 +174,11 @@ private Mono> getWithResponseAsync(String fi * @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 price and Metadata information for resources. + * @return price and Metadata information for resources on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String filter) { - return getWithResponseAsync(filter) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return getWithResponseAsync(filter).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -226,7 +217,7 @@ public ResourceRateCardInfoInner get(String filter) { * @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 price and Metadata information for resources. + * @return price and Metadata information for resources along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String filter, Context context) { diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsImpl.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsImpl.java index e2d2459366b6..c4b19475fb28 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsImpl.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsImpl.java @@ -12,10 +12,9 @@ import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; import com.azure.resourcemanager.commerce.models.RateCards; import com.azure.resourcemanager.commerce.models.ResourceRateCardInfo; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class RateCardsImpl implements RateCards { - @JsonIgnore private final ClientLogger logger = new ClientLogger(RateCardsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(RateCardsImpl.class); private final RateCardsClient innerClient; diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/ResourceRateCardInfoImpl.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/ResourceRateCardInfoImpl.java index 05e0eafe42cc..b877ec00b301 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/ResourceRateCardInfoImpl.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/ResourceRateCardInfoImpl.java @@ -6,7 +6,7 @@ import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; import com.azure.resourcemanager.commerce.models.MeterInfo; -import com.azure.resourcemanager.commerce.models.OfferTermInfo; +import com.azure.resourcemanager.commerce.models.OfferTermInfoAutoGenerated; import com.azure.resourcemanager.commerce.models.ResourceRateCardInfo; import java.util.Collections; import java.util.List; @@ -34,8 +34,8 @@ public Boolean isTaxIncluded() { return this.innerModel().isTaxIncluded(); } - public List offerTerms() { - List inner = this.innerModel().offerTerms(); + public List offerTerms() { + List inner = this.innerModel().offerTerms(); if (inner != null) { return Collections.unmodifiableList(inner); } else { diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesClientImpl.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesClientImpl.java index fa34ef6365c2..5c33afd7e8f1 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesClientImpl.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesClientImpl.java @@ -25,7 +25,6 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.commerce.fluent.UsageAggregatesClient; import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; import com.azure.resourcemanager.commerce.models.AggregationGranularity; @@ -35,8 +34,6 @@ /** An instance of this class provides access to all the operations defined in UsageAggregatesClient. */ public final class UsageAggregatesClientImpl implements UsageAggregatesClient { - private final ClientLogger logger = new ClientLogger(UsageAggregatesClientImpl.class); - /** The proxy service used to perform REST calls. */ private final UsageAggregatesService service; @@ -106,7 +103,8 @@ Mono> listNext( * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync( @@ -182,7 +180,8 @@ private Mono> listSinglePageAsync( * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync( @@ -255,7 +254,7 @@ private Mono> listSinglePageAsync( * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync( @@ -279,7 +278,7 @@ private PagedFlux listAsync( * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync( @@ -313,7 +312,7 @@ private PagedFlux listAsync( * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync( @@ -343,7 +342,7 @@ private PagedFlux listAsync( * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(OffsetDateTime reportedStartTime, OffsetDateTime reportedEndTime) { @@ -373,7 +372,7 @@ public PagedIterable list(OffsetDateTime reportedStartTim * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list( @@ -395,7 +394,8 @@ public PagedIterable list( * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -431,7 +431,8 @@ private Mono> listNextSinglePageAsync(Strin * @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 the Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, Context context) { diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesImpl.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesImpl.java index b39964d707d6..aa7b5c823b85 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesImpl.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesImpl.java @@ -12,11 +12,10 @@ import com.azure.resourcemanager.commerce.models.AggregationGranularity; import com.azure.resourcemanager.commerce.models.UsageAggregates; import com.azure.resourcemanager.commerce.models.UsageAggregation; -import com.fasterxml.jackson.annotation.JsonIgnore; import java.time.OffsetDateTime; public final class UsageAggregatesImpl implements UsageAggregates { - @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageAggregatesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(UsageAggregatesImpl.class); private final UsageAggregatesClient innerClient; diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientBuilder.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientBuilder.java index 5e0dab77ae5a..ef9f2d6395db 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientBuilder.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientBuilder.java @@ -7,7 +7,6 @@ import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.AzureEnvironment; @@ -69,34 +68,34 @@ public UsageManagementClientBuilder environment(AzureEnvironment environment) { } /* - * The default poll interval for long-running operation + * The HTTP pipeline to send requests through */ - private Duration defaultPollInterval; + private HttpPipeline pipeline; /** - * Sets The default poll interval for long-running operation. + * Sets The HTTP pipeline to send requests through. * - * @param defaultPollInterval the defaultPollInterval value. + * @param pipeline the pipeline value. * @return the UsageManagementClientBuilder. */ - public UsageManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; + public UsageManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; return this; } /* - * The HTTP pipeline to send requests through + * The default poll interval for long-running operation */ - private HttpPipeline pipeline; + private Duration defaultPollInterval; /** - * Sets The HTTP pipeline to send requests through. + * Sets The default poll interval for long-running operation. * - * @param pipeline the pipeline value. + * @param defaultPollInterval the defaultPollInterval value. * @return the UsageManagementClientBuilder. */ - public UsageManagementClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + public UsageManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; return this; } @@ -128,15 +127,12 @@ public UsageManagementClientImpl buildClient() { if (environment == null) { this.environment = AzureEnvironment.AZURE; } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } if (defaultPollInterval == null) { this.defaultPollInterval = Duration.ofSeconds(30); } - if (pipeline == null) { - this.pipeline = - new HttpPipelineBuilder() - .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) - .build(); - } if (serializerAdapter == null) { this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); } diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientImpl.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientImpl.java index accc517928d3..c3b9b47d38ab 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientImpl.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientImpl.java @@ -15,6 +15,7 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -30,15 +31,12 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.time.Duration; -import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** Initializes a new instance of the UsageManagementClientImpl type. */ @ServiceClient(builder = UsageManagementClientBuilder.class) public final class UsageManagementClientImpl implements UsageManagementClient { - private final ClientLogger logger = new ClientLogger(UsageManagementClientImpl.class); - /** * It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every service * call. @@ -183,10 +181,7 @@ public Context getContext() { * @return the merged context. */ public Context mergeContext(Context context) { - for (Map.Entry entry : this.getContext().getValues().entrySet()) { - context = context.addData(entry.getKey(), entry.getValue()); - } - return context; + return CoreUtils.mergeContexts(this.getContext(), context); } /** @@ -250,7 +245,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, managementError = null; } } catch (IOException | RuntimeException ioe) { - logger.logThrowableAsWarning(ioe); + LOGGER.logThrowableAsWarning(ioe); } } } else { @@ -309,4 +304,6 @@ public Mono getBodyAsString(Charset charset) { return Mono.just(new String(responseBody, charset)); } } + + private static final ClientLogger LOGGER = new ClientLogger(UsageManagementClientImpl.class); } diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/InfoField.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/InfoField.java index c9583b17f75c..c7dada17827a 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/InfoField.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/InfoField.java @@ -5,15 +5,11 @@ package com.azure.resourcemanager.commerce.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Key-value pairs of instance details in the legacy format. */ @Fluent public final class InfoField { - @JsonIgnore private final ClientLogger logger = new ClientLogger(InfoField.class); - /* * Identifies the name of the instance provisioned by the user. */ diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MeterInfo.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MeterInfo.java index 6686aaccbf41..17ac11c9b052 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MeterInfo.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MeterInfo.java @@ -5,8 +5,7 @@ package com.azure.resourcemanager.commerce.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; @@ -16,8 +15,6 @@ /** Detailed information about the meter. */ @Fluent public final class MeterInfo { - @JsonIgnore private final ClientLogger logger = new ClientLogger(MeterInfo.class); - /* * The unique identifier of the resource. */ @@ -69,6 +66,7 @@ public final class MeterInfo { * corresponding price */ @JsonProperty(value = "MeterRates") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map meterRates; /* diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCommitment.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCommitment.java index 7b6e23696ae3..15beaa9ae472 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCommitment.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCommitment.java @@ -5,8 +5,7 @@ package com.azure.resourcemanager.commerce.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -20,9 +19,7 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "Name") @JsonTypeName("Monetary Commitment") @Fluent -public final class MonetaryCommitment extends OfferTermInfo { - @JsonIgnore private final ClientLogger logger = new ClientLogger(MonetaryCommitment.class); - +public final class MonetaryCommitment extends OfferTermInfoAutoGenerated { /* * The list of key/value pairs for the tiered meter rates, in the format * 'key':'value' where key = price, and value = the corresponding discount @@ -30,6 +27,7 @@ public final class MonetaryCommitment extends OfferTermInfo { * Commitment'. */ @JsonProperty(value = "TieredDiscount") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tieredDiscount; /* diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCredit.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCredit.java index b4af426b36bc..918cf327650a 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCredit.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCredit.java @@ -5,8 +5,6 @@ package com.azure.resourcemanager.commerce.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -19,9 +17,7 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "Name") @JsonTypeName("Monetary Credit") @Fluent -public final class MonetaryCredit extends OfferTermInfo { - @JsonIgnore private final ClientLogger logger = new ClientLogger(MonetaryCredit.class); - +public final class MonetaryCredit extends OfferTermInfoAutoGenerated { /* * The amount of credit provided under the terms of the given offer level. */ diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfo.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfo.java index 6facad9c2da4..985d59a0acf0 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfo.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfo.java @@ -4,62 +4,47 @@ package com.azure.resourcemanager.commerce.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; -/** Describes the offer term. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "Name", - defaultImpl = OfferTermInfo.class) -@JsonTypeName("OfferTermInfo") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "Monetary Credit", value = MonetaryCredit.class), - @JsonSubTypes.Type(name = "Monetary Commitment", value = MonetaryCommitment.class), - @JsonSubTypes.Type(name = "Recurring Charge", value = RecurringCharge.class) -}) -@Fluent -public class OfferTermInfo { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OfferTermInfo.class); +/** Defines values for OfferTermInfo. */ +public enum OfferTermInfo { + /** Enum value Recurring Charge. */ + RECURRING_CHARGE("Recurring Charge"), - /* - * Indicates the date from which the offer term is effective. - */ - @JsonProperty(value = "EffectiveDate") - private OffsetDateTime effectiveDate; + /** Enum value Monetary Commitment. */ + MONETARY_COMMITMENT("Monetary Commitment"), - /** - * Get the effectiveDate property: Indicates the date from which the offer term is effective. - * - * @return the effectiveDate value. - */ - public OffsetDateTime effectiveDate() { - return this.effectiveDate; + /** Enum value Monetary Credit. */ + MONETARY_CREDIT("Monetary Credit"); + + /** The actual serialized value for a OfferTermInfo instance. */ + private final String value; + + OfferTermInfo(String value) { + this.value = value; } /** - * Set the effectiveDate property: Indicates the date from which the offer term is effective. + * Parses a serialized value to a OfferTermInfo instance. * - * @param effectiveDate the effectiveDate value to set. - * @return the OfferTermInfo object itself. + * @param value the serialized value to parse. + * @return the parsed OfferTermInfo object, or null if unable to parse. */ - public OfferTermInfo withEffectiveDate(OffsetDateTime effectiveDate) { - this.effectiveDate = effectiveDate; - return this; + @JsonCreator + public static OfferTermInfo fromString(String value) { + OfferTermInfo[] items = OfferTermInfo.values(); + for (OfferTermInfo item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { + @JsonValue + @Override + public String toString() { + return this.value; } } diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfoAutoGenerated.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfoAutoGenerated.java new file mode 100644 index 000000000000..9b1313570dc0 --- /dev/null +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfoAutoGenerated.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.commerce.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; + +/** Describes the offer term. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "Name", + defaultImpl = OfferTermInfoAutoGenerated.class) +@JsonTypeName("OfferTermInfoAutoGenerated") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Monetary Credit", value = MonetaryCredit.class), + @JsonSubTypes.Type(name = "Monetary Commitment", value = MonetaryCommitment.class), + @JsonSubTypes.Type(name = "Recurring Charge", value = RecurringCharge.class) +}) +@Fluent +public class OfferTermInfoAutoGenerated { + /* + * Indicates the date from which the offer term is effective. + */ + @JsonProperty(value = "EffectiveDate") + private OffsetDateTime effectiveDate; + + /** + * Get the effectiveDate property: Indicates the date from which the offer term is effective. + * + * @return the effectiveDate value. + */ + public OffsetDateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Set the effectiveDate property: Indicates the date from which the offer term is effective. + * + * @param effectiveDate the effectiveDate value to set. + * @return the OfferTermInfoAutoGenerated object itself. + */ + public OfferTermInfoAutoGenerated withEffectiveDate(OffsetDateTime effectiveDate) { + this.effectiveDate = effectiveDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfoValue.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfoValue.java deleted file mode 100644 index acf51ccc70ed..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfoValue.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for OfferTermInfoValue. */ -public enum OfferTermInfoValue { - /** Enum value Recurring Charge. */ - RECURRING_CHARGE("Recurring Charge"), - - /** Enum value Monetary Commitment. */ - MONETARY_COMMITMENT("Monetary Commitment"), - - /** Enum value Monetary Credit. */ - MONETARY_CREDIT("Monetary Credit"); - - /** The actual serialized value for a OfferTermInfoValue instance. */ - private final String value; - - OfferTermInfoValue(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a OfferTermInfoValue instance. - * - * @param value the serialized value to parse. - * @return the parsed OfferTermInfoValue object, or null if unable to parse. - */ - @JsonCreator - public static OfferTermInfoValue fromString(String value) { - OfferTermInfoValue[] items = OfferTermInfoValue.values(); - for (OfferTermInfoValue item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RateCards.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RateCards.java index 3eb8f17ff634..71be777b41c5 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RateCards.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RateCards.java @@ -42,7 +42,7 @@ public interface RateCards { * @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 price and Metadata information for resources. + * @return price and Metadata information for resources along with {@link Response}. */ Response getWithResponse(String filter, Context context); } diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RecurringCharge.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RecurringCharge.java index 5e621a54f083..9a176eeb74e9 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RecurringCharge.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RecurringCharge.java @@ -5,8 +5,6 @@ package com.azure.resourcemanager.commerce.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -16,9 +14,7 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "Name") @JsonTypeName("Recurring Charge") @Fluent -public final class RecurringCharge extends OfferTermInfo { - @JsonIgnore private final ClientLogger logger = new ClientLogger(RecurringCharge.class); - +public final class RecurringCharge extends OfferTermInfoAutoGenerated { /* * The amount of recurring charge as per the offer term. */ diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/ResourceRateCardInfo.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/ResourceRateCardInfo.java index d2d740ac56a7..bd7ccdb02ea3 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/ResourceRateCardInfo.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/ResourceRateCardInfo.java @@ -35,7 +35,7 @@ public interface ResourceRateCardInfo { * * @return the offerTerms value. */ - List offerTerms(); + List offerTerms(); /** * Gets the meters property: A list of meters. diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregates.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregates.java index 18e8e306813a..5ae95531a338 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregates.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregates.java @@ -18,7 +18,7 @@ public interface UsageAggregates { * @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 Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. */ PagedIterable list(OffsetDateTime reportedStartTime, OffsetDateTime reportedEndTime); @@ -41,7 +41,7 @@ public interface UsageAggregates { * @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 Get UsageAggregates operation response. + * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. */ PagedIterable list( OffsetDateTime reportedStartTime, diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregationListResult.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregationListResult.java index f4601ec55541..886bd5d51d90 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregationListResult.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregationListResult.java @@ -5,17 +5,13 @@ package com.azure.resourcemanager.commerce.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** The Get UsageAggregates operation response. */ @Fluent public final class UsageAggregationListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageAggregationListResult.class); - /* * Gets or sets details for the requested aggregation. */ diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/samples/java/com/azure/resourcemanager/commerce/generated/RateCardGetSamples.java b/sdk/commerce/azure-resourcemanager-commerce/src/samples/java/com/azure/resourcemanager/commerce/generated/RateCardGetSamples.java new file mode 100644 index 000000000000..80462e9335f4 --- /dev/null +++ b/sdk/commerce/azure-resourcemanager-commerce/src/samples/java/com/azure/resourcemanager/commerce/generated/RateCardGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.commerce.generated; + +import com.azure.core.util.Context; + +/** Samples for RateCard Get. */ +public final class RateCardGetSamples { + /* + * x-ms-original-file: specification/commerce/resource-manager/Microsoft.Commerce/preview/2015-06-01-preview/examples/GetRateCard.json + */ + /** + * Sample code: GetRateCard. + * + * @param manager Entry point to UsageManager. + */ + public static void getRateCard(com.azure.resourcemanager.commerce.UsageManager manager) { + manager + .rateCards() + .getWithResponse( + "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'", + Context.NONE); + } +}