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 deleted file mode 100644 index 18dd7563788c..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java +++ /dev/null @@ -1,298 +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; - -import com.azure.core.credential.TokenCredential; -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.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; -import com.azure.resourcemanager.commerce.fluent.UsageManagementClient; -import com.azure.resourcemanager.commerce.implementation.RateCardsImpl; -import com.azure.resourcemanager.commerce.implementation.UsageAggregatesImpl; -import com.azure.resourcemanager.commerce.implementation.UsageManagementClientBuilder; -import com.azure.resourcemanager.commerce.models.RateCards; -import com.azure.resourcemanager.commerce.models.UsageAggregates; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -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 { - private UsageAggregates usageAggregates; - - private RateCards rateCards; - - private final UsageManagementClient clientObject; - - private UsageManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = - new UsageManagementClientBuilder() - .pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of Usage service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the Usage service API instance. - */ - public static UsageManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - 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. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new UsageManager.Configurable(); - } - - /** The Configurable allowing configurations to be set. */ - public static final class Configurable { - 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() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - 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. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - 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. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = - Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of Usage service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the Usage service API instance. - */ - public UsageManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder - .append("azsdk-java") - .append("-") - .append("com.azure.resourcemanager.commerce") - .append("/") - .append("1.0.0-beta.2"); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder - .append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - 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 - .addAll( - this - .policies - .stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = - new HttpPipelineBuilder() - .httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new UsageManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * 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); - } - return usageAggregates; - } - - /** - * 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); - } - return rateCards; - } - - /** - * @return Wrapped service client UsageManagementClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - */ - public UsageManagementClient serviceClient() { - return this.clientObject; - } -} 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 deleted file mode 100644 index 03ad7c8323e8..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/RateCardsClient.java +++ /dev/null @@ -1,53 +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.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; - -/** An instance of this class provides access to all the operations defined in RateCardsClient. */ -public interface RateCardsClient { - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return price and Metadata information for resources along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String filter, Context context); - - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $filter. - * @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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ResourceRateCardInfoInner get(String filter); -} 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 deleted file mode 100644 index 4c3d767c5740..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/UsageAggregatesClient.java +++ /dev/null @@ -1,59 +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.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.azure.resourcemanager.commerce.models.AggregationGranularity; -import java.time.OffsetDateTime; - -/** An instance of this class provides access to all the operations defined in UsageAggregatesClient. */ -public interface UsageAggregatesClient { - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @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 as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(OffsetDateTime reportedStartTime, OffsetDateTime reportedEndTime); - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @param showDetails `True` returns usage data in instance-level detail, `false` causes server-side aggregation - * with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for - * website consumption. If you specify showDetails = false, the data will be aggregated as a single line item - * for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and - * usageEndTime). - * @param aggregationGranularity `Daily` (default) returns the data in daily granularity, `Hourly` returns the data - * in hourly granularity. - * @param continuationToken Used when a continuation token string is provided in the response body of the previous - * call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of - * the day/hour (based on the granularity) passed in. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list( - OffsetDateTime reportedStartTime, - OffsetDateTime reportedEndTime, - Boolean showDetails, - AggregationGranularity aggregationGranularity, - String continuationToken, - Context context); -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/UsageManagementClient.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/UsageManagementClient.java deleted file mode 100644 index b561c0f7f9cd..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/UsageManagementClient.java +++ /dev/null @@ -1,61 +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.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** The interface for UsageManagementClient class. */ -public interface UsageManagementClient { - /** - * Gets It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every - * service call. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets server parameter. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the UsageAggregatesClient object to access its operations. - * - * @return the UsageAggregatesClient object. - */ - UsageAggregatesClient getUsageAggregates(); - - /** - * Gets the RateCardsClient object to access its operations. - * - * @return the RateCardsClient object. - */ - RateCardsClient getRateCards(); -} 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 deleted file mode 100644 index 87d013b68242..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/ResourceRateCardInfoInner.java +++ /dev/null @@ -1,163 +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.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.commerce.models.MeterInfo; -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 { - /* - * The currency in which the rates are provided. - */ - @JsonProperty(value = "Currency") - private String currency; - - /* - * The culture in which the resource information is localized. - */ - @JsonProperty(value = "Locale") - private String locale; - - /* - * All rates are pretax, so this will always be returned as 'false'. - */ - @JsonProperty(value = "IsTaxIncluded") - private Boolean isTaxIncluded; - - /* - * A list of offer terms. - */ - @JsonProperty(value = "OfferTerms") - private List offerTerms; - - /* - * A list of meters. - */ - @JsonProperty(value = "Meters") - private List meters; - - /** Creates an instance of ResourceRateCardInfoInner class. */ - public ResourceRateCardInfoInner() { - } - - /** - * Get the currency property: The currency in which the rates are provided. - * - * @return the currency value. - */ - public String currency() { - return this.currency; - } - - /** - * Set the currency property: The currency in which the rates are provided. - * - * @param currency the currency value to set. - * @return the ResourceRateCardInfoInner object itself. - */ - public ResourceRateCardInfoInner withCurrency(String currency) { - this.currency = currency; - return this; - } - - /** - * Get the locale property: The culture in which the resource information is localized. - * - * @return the locale value. - */ - public String locale() { - return this.locale; - } - - /** - * Set the locale property: The culture in which the resource information is localized. - * - * @param locale the locale value to set. - * @return the ResourceRateCardInfoInner object itself. - */ - public ResourceRateCardInfoInner withLocale(String locale) { - this.locale = locale; - return this; - } - - /** - * Get the isTaxIncluded property: All rates are pretax, so this will always be returned as 'false'. - * - * @return the isTaxIncluded value. - */ - public Boolean isTaxIncluded() { - return this.isTaxIncluded; - } - - /** - * Set the isTaxIncluded property: All rates are pretax, so this will always be returned as 'false'. - * - * @param isTaxIncluded the isTaxIncluded value to set. - * @return the ResourceRateCardInfoInner object itself. - */ - public ResourceRateCardInfoInner withIsTaxIncluded(Boolean isTaxIncluded) { - this.isTaxIncluded = isTaxIncluded; - return this; - } - - /** - * Get the offerTerms property: A list of offer terms. - * - * @return the offerTerms value. - */ - public List offerTerms() { - return this.offerTerms; - } - - /** - * Set the offerTerms property: A list of offer terms. - * - * @param offerTerms the offerTerms value to set. - * @return the ResourceRateCardInfoInner object itself. - */ - public ResourceRateCardInfoInner withOfferTerms(List offerTerms) { - this.offerTerms = offerTerms; - return this; - } - - /** - * Get the meters property: A list of meters. - * - * @return the meters value. - */ - public List meters() { - return this.meters; - } - - /** - * Set the meters property: A list of meters. - * - * @param meters the meters value to set. - * @return the ResourceRateCardInfoInner object itself. - */ - public ResourceRateCardInfoInner withMeters(List meters) { - this.meters = meters; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (offerTerms() != null) { - offerTerms().forEach(e -> e.validate()); - } - if (meters() != null) { - meters().forEach(e -> e.validate()); - } - } -} 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 deleted file mode 100644 index adf7985cade4..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageAggregationInner.java +++ /dev/null @@ -1,399 +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.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 the usageAggregation. */ -@Fluent -public final class UsageAggregationInner { - /* - * Unique Id for the usage aggregate. - */ - @JsonProperty(value = "id") - private String id; - - /* - * Name of the usage aggregate. - */ - @JsonProperty(value = "name") - private String name; - - /* - * Type of the resource being returned. - */ - @JsonProperty(value = "type") - private String type; - - /* - * Usage data. - */ - @JsonProperty(value = "properties") - private UsageSample innerProperties; - - /** Creates an instance of UsageAggregationInner class. */ - public UsageAggregationInner() { - } - - /** - * Get the id property: Unique Id for the usage aggregate. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Set the id property: Unique Id for the usage aggregate. - * - * @param id the id value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withId(String id) { - this.id = id; - return this; - } - - /** - * Get the name property: Name of the usage aggregate. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: Name of the usage aggregate. - * - * @param name the name value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the type property: Type of the resource being returned. - * - * @return the type value. - */ - public String type() { - return this.type; - } - - /** - * Set the type property: Type of the resource being returned. - * - * @param type the type value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withType(String type) { - this.type = 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.innerProperties() == null ? null : this.innerProperties().subscriptionId(); - } - - /** - * Set the subscriptionId property: The subscription identifier for the Azure user. - * - * @param subscriptionId the subscriptionId value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withSubscriptionId(UUID subscriptionId) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withSubscriptionId(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.innerProperties() == null ? null : this.innerProperties().meterId(); - } - - /** - * Set the meterId property: Unique ID for the resource that was consumed (aka ResourceID). - * - * @param meterId the meterId value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withMeterId(String meterId) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withMeterId(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.innerProperties() == null ? null : this.innerProperties().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 UsageAggregationInner object itself. - */ - public UsageAggregationInner withUsageStartTime(OffsetDateTime usageStartTime) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withUsageStartTime(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.innerProperties() == null ? null : this.innerProperties().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 UsageAggregationInner object itself. - */ - public UsageAggregationInner withUsageEndTime(OffsetDateTime usageEndTime) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withUsageEndTime(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.innerProperties() == null ? null : this.innerProperties().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 UsageAggregationInner object itself. - */ - public UsageAggregationInner withQuantity(Float quantity) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withQuantity(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.innerProperties() == null ? null : this.innerProperties().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 UsageAggregationInner object itself. - */ - public UsageAggregationInner withUnit(String unit) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withUnit(unit); - return this; - } - - /** - * Get the meterName property: Friendly name of the resource being consumed. - * - * @return the meterName value. - */ - public String meterName() { - return this.innerProperties() == null ? null : this.innerProperties().meterName(); - } - - /** - * Set the meterName property: Friendly name of the resource being consumed. - * - * @param meterName the meterName value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withMeterName(String meterName) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withMeterName(meterName); - return this; - } - - /** - * Get the meterCategory property: Category of the consumed resource. - * - * @return the meterCategory value. - */ - public String meterCategory() { - return this.innerProperties() == null ? null : this.innerProperties().meterCategory(); - } - - /** - * Set the meterCategory property: Category of the consumed resource. - * - * @param meterCategory the meterCategory value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withMeterCategory(String meterCategory) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withMeterCategory(meterCategory); - return this; - } - - /** - * Get the meterSubCategory property: Sub-category of the consumed resource. - * - * @return the meterSubCategory value. - */ - public String meterSubCategory() { - return this.innerProperties() == null ? null : this.innerProperties().meterSubCategory(); - } - - /** - * Set the meterSubCategory property: Sub-category of the consumed resource. - * - * @param meterSubCategory the meterSubCategory value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withMeterSubCategory(String meterSubCategory) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withMeterSubCategory(meterSubCategory); - return this; - } - - /** - * Get the meterRegion property: Region of the meterId used for billing purposes. - * - * @return the meterRegion value. - */ - public String meterRegion() { - return this.innerProperties() == null ? null : this.innerProperties().meterRegion(); - } - - /** - * Set the meterRegion property: Region of the meterId used for billing purposes. - * - * @param meterRegion the meterRegion value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withMeterRegion(String meterRegion) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withMeterRegion(meterRegion); - return this; - } - - /** - * Get the infoFields property: Key-value pairs of instance details (legacy format). - * - * @return the infoFields value. - */ - public InfoField infoFields() { - return this.innerProperties() == null ? null : this.innerProperties().infoFields(); - } - - /** - * Set the infoFields property: Key-value pairs of instance details (legacy format). - * - * @param infoFields the infoFields value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withInfoFields(InfoField infoFields) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withInfoFields(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.innerProperties() == null ? null : this.innerProperties().instanceData(); - } - - /** - * Set the instanceData property: Key-value pairs of instance details represented as a string. - * - * @param instanceData the instanceData value to set. - * @return the UsageAggregationInner object itself. - */ - public UsageAggregationInner withInstanceData(String instanceData) { - if (this.innerProperties() == null) { - this.innerProperties = new UsageSample(); - } - this.innerProperties().withInstanceData(instanceData); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void 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 deleted file mode 100644 index f1e887e3d5c3..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/UsageSample.java +++ /dev/null @@ -1,342 +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.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; - - /** Creates an instance of UsageSample class. */ - public UsageSample() { - } - - /** - * 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/fluent/models/package-info.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/package-info.java deleted file mode 100644 index 95dfd6f62d68..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/models/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** Package containing the inner data models for UsageManagementClient. null. */ -package com.azure.resourcemanager.commerce.fluent.models; diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/package-info.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/package-info.java deleted file mode 100644 index 0ff5924abd21..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/fluent/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** Package containing the service clients for UsageManagementClient. null. */ -package com.azure.resourcemanager.commerce.fluent; 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 deleted file mode 100644 index 1c8e1cbb6ea7..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsClientImpl.java +++ /dev/null @@ -1,226 +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.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -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 { - /** The proxy service used to perform REST calls. */ - private final RateCardsService service; - - /** The service client containing this operation class. */ - private final UsageManagementClientImpl client; - - /** - * Initializes an instance of RateCardsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - RateCardsClientImpl(UsageManagementClientImpl client) { - this.service = - RestProxy.create(RateCardsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UsageManagementClientRateCards to be used by the proxy service to - * perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "UsageManagementClien") - public interface RateCardsService { - @Headers({"Content-Type: application/json"}) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get( - @HostParam("$host") String endpoint, - @QueryParam("$filter") String filter, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $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 along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String filter) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (filter == null) { - return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json, text/json"; - return FluxUtil - .withContext( - context -> - service - .get( - this.client.getEndpoint(), - filter, - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return 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) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (filter == null) { - return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json, text/json"; - context = this.client.mergeContext(context); - return service - .get( - this.client.getEndpoint(), - filter, - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context); - } - - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $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 on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String filter) { - return getWithResponseAsync(filter).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return price and Metadata information for resources along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String filter, Context context) { - return getWithResponseAsync(filter, context).block(); - } - - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceRateCardInfoInner get(String filter) { - return getWithResponse(filter, Context.NONE).getValue(); - } -} 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 deleted file mode 100644 index 909219c26c7f..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/RateCardsImpl.java +++ /dev/null @@ -1,57 +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.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.commerce.fluent.RateCardsClient; -import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; -import com.azure.resourcemanager.commerce.models.RateCards; -import com.azure.resourcemanager.commerce.models.ResourceRateCardInfo; - -public final class RateCardsImpl implements RateCards { - private static final ClientLogger LOGGER = new ClientLogger(RateCardsImpl.class); - - private final RateCardsClient innerClient; - - private final com.azure.resourcemanager.commerce.UsageManager serviceManager; - - public RateCardsImpl(RateCardsClient innerClient, com.azure.resourcemanager.commerce.UsageManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String filter, Context context) { - Response inner = this.serviceClient().getWithResponse(filter, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new ResourceRateCardInfoImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ResourceRateCardInfo get(String filter) { - ResourceRateCardInfoInner inner = this.serviceClient().get(filter); - if (inner != null) { - return new ResourceRateCardInfoImpl(inner, this.manager()); - } else { - return null; - } - } - - private RateCardsClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.commerce.UsageManager manager() { - return this.serviceManager; - } -} 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 deleted file mode 100644 index b877ec00b301..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/ResourceRateCardInfoImpl.java +++ /dev/null @@ -1,62 +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.implementation; - -import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; -import com.azure.resourcemanager.commerce.models.MeterInfo; -import com.azure.resourcemanager.commerce.models.OfferTermInfoAutoGenerated; -import com.azure.resourcemanager.commerce.models.ResourceRateCardInfo; -import java.util.Collections; -import java.util.List; - -public final class ResourceRateCardInfoImpl implements ResourceRateCardInfo { - private ResourceRateCardInfoInner innerObject; - - private final com.azure.resourcemanager.commerce.UsageManager serviceManager; - - ResourceRateCardInfoImpl( - ResourceRateCardInfoInner innerObject, com.azure.resourcemanager.commerce.UsageManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String currency() { - return this.innerModel().currency(); - } - - public String locale() { - return this.innerModel().locale(); - } - - public Boolean isTaxIncluded() { - return this.innerModel().isTaxIncluded(); - } - - public List offerTerms() { - List inner = this.innerModel().offerTerms(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public List meters() { - List inner = this.innerModel().meters(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public ResourceRateCardInfoInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.commerce.UsageManager manager() { - return this.serviceManager; - } -} 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 deleted file mode 100644 index 43bdbe380492..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesClientImpl.java +++ /dev/null @@ -1,464 +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.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.commerce.fluent.UsageAggregatesClient; -import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.azure.resourcemanager.commerce.models.AggregationGranularity; -import com.azure.resourcemanager.commerce.models.UsageAggregationListResult; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -/** An instance of this class provides access to all the operations defined in UsageAggregatesClient. */ -public final class UsageAggregatesClientImpl implements UsageAggregatesClient { - /** The proxy service used to perform REST calls. */ - private final UsageAggregatesService service; - - /** The service client containing this operation class. */ - private final UsageManagementClientImpl client; - - /** - * Initializes an instance of UsageAggregatesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UsageAggregatesClientImpl(UsageManagementClientImpl client) { - this.service = - RestProxy.create(UsageAggregatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UsageManagementClientUsageAggregates to be used by the proxy service - * to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "UsageManagementClien") - public interface UsageAggregatesService { - @Headers({"Content-Type: application/json"}) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( - @HostParam("$host") String endpoint, - @QueryParam("reportedStartTime") OffsetDateTime reportedStartTime, - @QueryParam("reportedEndTime") OffsetDateTime reportedEndTime, - @QueryParam("showDetails") Boolean showDetails, - @QueryParam("aggregationGranularity") AggregationGranularity aggregationGranularity, - @QueryParam("continuationToken") String continuationToken, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @param showDetails `True` returns usage data in instance-level detail, `false` causes server-side aggregation - * with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for - * website consumption. If you specify showDetails = false, the data will be aggregated as a single line item - * for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and - * usageEndTime). - * @param aggregationGranularity `Daily` (default) returns the data in daily granularity, `Hourly` returns the data - * in hourly granularity. - * @param continuationToken Used when a continuation token string is provided in the response body of the previous - * call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of - * the day/hour (based on the granularity) passed in. - * @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 along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync( - OffsetDateTime reportedStartTime, - OffsetDateTime reportedEndTime, - Boolean showDetails, - AggregationGranularity aggregationGranularity, - String continuationToken) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (reportedStartTime == null) { - return Mono - .error(new IllegalArgumentException("Parameter reportedStartTime is required and cannot be null.")); - } - if (reportedEndTime == null) { - return Mono - .error(new IllegalArgumentException("Parameter reportedEndTime is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json, text/json"; - return FluxUtil - .withContext( - context -> - service - .list( - this.client.getEndpoint(), - reportedStartTime, - reportedEndTime, - showDetails, - aggregationGranularity, - continuationToken, - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @param showDetails `True` returns usage data in instance-level detail, `false` causes server-side aggregation - * with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for - * website consumption. If you specify showDetails = false, the data will be aggregated as a single line item - * for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and - * usageEndTime). - * @param aggregationGranularity `Daily` (default) returns the data in daily granularity, `Hourly` returns the data - * in hourly granularity. - * @param continuationToken Used when a continuation token string is provided in the response body of the previous - * call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of - * the day/hour (based on the granularity) passed in. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Get UsageAggregates operation response along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync( - OffsetDateTime reportedStartTime, - OffsetDateTime reportedEndTime, - Boolean showDetails, - AggregationGranularity aggregationGranularity, - String continuationToken, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (reportedStartTime == null) { - return Mono - .error(new IllegalArgumentException("Parameter reportedStartTime is required and cannot be null.")); - } - if (reportedEndTime == null) { - return Mono - .error(new IllegalArgumentException("Parameter reportedEndTime is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json, text/json"; - context = this.client.mergeContext(context); - return service - .list( - this.client.getEndpoint(), - reportedStartTime, - reportedEndTime, - showDetails, - aggregationGranularity, - continuationToken, - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @param showDetails `True` returns usage data in instance-level detail, `false` causes server-side aggregation - * with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for - * website consumption. If you specify showDetails = false, the data will be aggregated as a single line item - * for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and - * usageEndTime). - * @param aggregationGranularity `Daily` (default) returns the data in daily granularity, `Hourly` returns the data - * in hourly granularity. - * @param continuationToken Used when a continuation token string is provided in the response body of the previous - * call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of - * the day/hour (based on the granularity) passed in. - * @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 as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync( - OffsetDateTime reportedStartTime, - OffsetDateTime reportedEndTime, - Boolean showDetails, - AggregationGranularity aggregationGranularity, - String continuationToken) { - return new PagedFlux<>( - () -> - listSinglePageAsync( - reportedStartTime, reportedEndTime, showDetails, aggregationGranularity, continuationToken), - nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @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 as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync( - OffsetDateTime reportedStartTime, OffsetDateTime reportedEndTime) { - final Boolean showDetails = null; - final AggregationGranularity aggregationGranularity = null; - final String continuationToken = null; - return new PagedFlux<>( - () -> - listSinglePageAsync( - reportedStartTime, reportedEndTime, showDetails, aggregationGranularity, continuationToken), - nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @param showDetails `True` returns usage data in instance-level detail, `false` causes server-side aggregation - * with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for - * website consumption. If you specify showDetails = false, the data will be aggregated as a single line item - * for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and - * usageEndTime). - * @param aggregationGranularity `Daily` (default) returns the data in daily granularity, `Hourly` returns the data - * in hourly granularity. - * @param continuationToken Used when a continuation token string is provided in the response body of the previous - * call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of - * the day/hour (based on the granularity) passed in. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Get UsageAggregates operation response as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync( - OffsetDateTime reportedStartTime, - OffsetDateTime reportedEndTime, - Boolean showDetails, - AggregationGranularity aggregationGranularity, - String continuationToken, - Context context) { - return new PagedFlux<>( - () -> - listSinglePageAsync( - reportedStartTime, - reportedEndTime, - showDetails, - aggregationGranularity, - continuationToken, - context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @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 as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(OffsetDateTime reportedStartTime, OffsetDateTime reportedEndTime) { - final Boolean showDetails = null; - final AggregationGranularity aggregationGranularity = null; - final String continuationToken = null; - return new PagedIterable<>( - listAsync(reportedStartTime, reportedEndTime, showDetails, aggregationGranularity, continuationToken)); - } - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @param showDetails `True` returns usage data in instance-level detail, `false` causes server-side aggregation - * with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for - * website consumption. If you specify showDetails = false, the data will be aggregated as a single line item - * for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and - * usageEndTime). - * @param aggregationGranularity `Daily` (default) returns the data in daily granularity, `Hourly` returns the data - * in hourly granularity. - * @param continuationToken Used when a continuation token string is provided in the response body of the previous - * call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of - * the day/hour (based on the granularity) passed in. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list( - OffsetDateTime reportedStartTime, - OffsetDateTime reportedEndTime, - Boolean showDetails, - AggregationGranularity aggregationGranularity, - String continuationToken, - Context context) { - return new PagedIterable<>( - listAsync( - reportedStartTime, reportedEndTime, showDetails, aggregationGranularity, continuationToken, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Get UsageAggregates operation response along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json, text/json"; - return FluxUtil - .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return 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) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json, text/json"; - context = this.client.mergeContext(context); - return service - .listNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } -} 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 deleted file mode 100644 index aa7b5c823b85..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregatesImpl.java +++ /dev/null @@ -1,62 +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.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -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; -import com.azure.resourcemanager.commerce.models.UsageAggregates; -import com.azure.resourcemanager.commerce.models.UsageAggregation; -import java.time.OffsetDateTime; - -public final class UsageAggregatesImpl implements UsageAggregates { - private static final ClientLogger LOGGER = new ClientLogger(UsageAggregatesImpl.class); - - private final UsageAggregatesClient innerClient; - - private final com.azure.resourcemanager.commerce.UsageManager serviceManager; - - public UsageAggregatesImpl( - UsageAggregatesClient innerClient, com.azure.resourcemanager.commerce.UsageManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list(OffsetDateTime reportedStartTime, OffsetDateTime reportedEndTime) { - PagedIterable inner = this.serviceClient().list(reportedStartTime, reportedEndTime); - return Utils.mapPage(inner, inner1 -> new UsageAggregationImpl(inner1, this.manager())); - } - - public PagedIterable list( - OffsetDateTime reportedStartTime, - OffsetDateTime reportedEndTime, - Boolean showDetails, - AggregationGranularity aggregationGranularity, - String continuationToken, - Context context) { - PagedIterable inner = - this - .serviceClient() - .list( - reportedStartTime, - reportedEndTime, - showDetails, - aggregationGranularity, - continuationToken, - context); - return Utils.mapPage(inner, inner1 -> new UsageAggregationImpl(inner1, this.manager())); - } - - private UsageAggregatesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.commerce.UsageManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregationImpl.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregationImpl.java deleted file mode 100644 index f2a97c000b58..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageAggregationImpl.java +++ /dev/null @@ -1,91 +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.implementation; - -import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.azure.resourcemanager.commerce.models.InfoField; -import com.azure.resourcemanager.commerce.models.UsageAggregation; -import java.time.OffsetDateTime; -import java.util.UUID; - -public final class UsageAggregationImpl implements UsageAggregation { - private UsageAggregationInner innerObject; - - private final com.azure.resourcemanager.commerce.UsageManager serviceManager; - - UsageAggregationImpl( - UsageAggregationInner innerObject, com.azure.resourcemanager.commerce.UsageManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public UUID subscriptionId() { - return this.innerModel().subscriptionId(); - } - - public String meterId() { - return this.innerModel().meterId(); - } - - public OffsetDateTime usageStartTime() { - return this.innerModel().usageStartTime(); - } - - public OffsetDateTime usageEndTime() { - return this.innerModel().usageEndTime(); - } - - public Float quantity() { - return this.innerModel().quantity(); - } - - public String unit() { - return this.innerModel().unit(); - } - - public String meterName() { - return this.innerModel().meterName(); - } - - public String meterCategory() { - return this.innerModel().meterCategory(); - } - - public String meterSubCategory() { - return this.innerModel().meterSubCategory(); - } - - public String meterRegion() { - return this.innerModel().meterRegion(); - } - - public InfoField infoFields() { - return this.innerModel().infoFields(); - } - - public String instanceData() { - return this.innerModel().instanceData(); - } - - public UsageAggregationInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.commerce.UsageManager manager() { - return this.serviceManager; - } -} 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 deleted file mode 100644 index cf402ff8fe00..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientBuilder.java +++ /dev/null @@ -1,146 +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.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** A builder for creating a new instance of the UsageManagementClientImpl type. */ -@ServiceClientBuilder(serviceClients = {UsageManagementClientImpl.class}) -public final class UsageManagementClientBuilder { - /* - * It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every service - * call. - */ - private String subscriptionId; - - /** - * Sets It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every - * service call. - * - * @param subscriptionId the subscriptionId value. - * @return the UsageManagementClientBuilder. - */ - public UsageManagementClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * server parameter - */ - private String endpoint; - - /** - * Sets server parameter. - * - * @param endpoint the endpoint value. - * @return the UsageManagementClientBuilder. - */ - public UsageManagementClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the UsageManagementClientBuilder. - */ - public UsageManagementClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - return this; - } - - /* - * The HTTP pipeline to send requests through - */ - private HttpPipeline pipeline; - - /** - * Sets The HTTP pipeline to send requests through. - * - * @param pipeline the pipeline value. - * @return the UsageManagementClientBuilder. - */ - public UsageManagementClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the UsageManagementClientBuilder. - */ - public UsageManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - return this; - } - - /* - * The serializer to serialize an object into a string - */ - private SerializerAdapter serializerAdapter; - - /** - * Sets The serializer to serialize an object into a string. - * - * @param serializerAdapter the serializerAdapter value. - * @return the UsageManagementClientBuilder. - */ - public UsageManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of UsageManagementClientImpl with the provided parameters. - * - * @return an instance of UsageManagementClientImpl. - */ - public UsageManagementClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = - (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval = - (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = - (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - UsageManagementClientImpl client = - new UsageManagementClientImpl( - localPipeline, - localSerializerAdapter, - localDefaultPollInterval, - localEnvironment, - subscriptionId, - localEndpoint); - return client; - } -} 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 deleted file mode 100644 index c3b9b47d38ab..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/UsageManagementClientImpl.java +++ /dev/null @@ -1,309 +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.implementation; - -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -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; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.commerce.fluent.RateCardsClient; -import com.azure.resourcemanager.commerce.fluent.UsageAggregatesClient; -import com.azure.resourcemanager.commerce.fluent.UsageManagementClient; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -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 { - /** - * It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every service - * call. - */ - private final String subscriptionId; - - /** - * Gets It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every - * service call. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** server parameter. */ - private final String endpoint; - - /** - * Gets server parameter. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** Api Version. */ - private final String apiVersion; - - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** The HTTP pipeline to send requests through. */ - private final HttpPipeline httpPipeline; - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - public HttpPipeline getHttpPipeline() { - return this.httpPipeline; - } - - /** The serializer to serialize an object into a string. */ - private final SerializerAdapter serializerAdapter; - - /** - * Gets The serializer to serialize an object into a string. - * - * @return the serializerAdapter value. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** The default poll interval for long-running operation. */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** The UsageAggregatesClient object to access its operations. */ - private final UsageAggregatesClient usageAggregates; - - /** - * Gets the UsageAggregatesClient object to access its operations. - * - * @return the UsageAggregatesClient object. - */ - public UsageAggregatesClient getUsageAggregates() { - return this.usageAggregates; - } - - /** The RateCardsClient object to access its operations. */ - private final RateCardsClient rateCards; - - /** - * Gets the RateCardsClient object to access its operations. - * - * @return the RateCardsClient object. - */ - public RateCardsClient getRateCards() { - return this.rateCards; - } - - /** - * Initializes an instance of UsageManagementClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param subscriptionId It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the - * URI for every service call. - * @param endpoint server parameter. - */ - UsageManagementClientImpl( - HttpPipeline httpPipeline, - SerializerAdapter serializerAdapter, - Duration defaultPollInterval, - AzureEnvironment environment, - String subscriptionId, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.subscriptionId = subscriptionId; - this.endpoint = endpoint; - this.apiVersion = "2015-06-01-preview"; - this.usageAggregates = new UsageAggregatesClientImpl(this); - this.rateCards = new RateCardsClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult( - Mono>> activationResponse, - HttpPipeline httpPipeline, - Type pollResultType, - Type finalResultType, - Context context) { - return PollerFactory - .create( - serializerAdapter, - httpPipeline, - pollResultType, - finalResultType, - defaultPollInterval, - activationResponse, - context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = - new HttpResponseImpl( - lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = - this - .getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(s); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - 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/implementation/Utils.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/Utils.java deleted file mode 100644 index bb82a00e4b31..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/Utils.java +++ /dev/null @@ -1,204 +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.implementation; - -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class Utils { - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (segments.size() > 0 && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super( - PagedFlux - .create( - () -> - (continuationToken, pageSize) -> - Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> - new PagedResponseBase( - page.getRequest(), - page.getStatusCode(), - page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), - page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl(iterable.iterator(), mapper); - } - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/package-info.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/package-info.java deleted file mode 100644 index 5326c7d5ef84..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/implementation/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** Package containing the implementations for UsageManagementClient. null. */ -package com.azure.resourcemanager.commerce.implementation; diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/AggregationGranularity.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/AggregationGranularity.java deleted file mode 100644 index 41ccd52696c0..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/AggregationGranularity.java +++ /dev/null @@ -1,51 +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 AggregationGranularity. */ -public enum AggregationGranularity { - /** Enum value Daily. */ - DAILY("Daily"), - - /** Enum value Hourly. */ - HOURLY("Hourly"); - - /** The actual serialized value for a AggregationGranularity instance. */ - private final String value; - - AggregationGranularity(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a AggregationGranularity instance. - * - * @param value the serialized value to parse. - * @return the parsed AggregationGranularity object, or null if unable to parse. - */ - @JsonCreator - public static AggregationGranularity fromString(String value) { - if (value == null) { - return null; - } - AggregationGranularity[] items = AggregationGranularity.values(); - for (AggregationGranularity item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; - } -} 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 deleted file mode 100644 index 7b7082c4df19..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/InfoField.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.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Key-value pairs of instance details in the legacy format. */ -@Fluent -public final class InfoField { - /* - * Identifies the name of the instance provisioned by the user. - */ - @JsonProperty(value = "project") - private String project; - - /** Creates an instance of InfoField class. */ - public InfoField() { - } - - /** - * Get the project property: Identifies the name of the instance provisioned by the user. - * - * @return the project value. - */ - public String project() { - return this.project; - } - - /** - * Set the project property: Identifies the name of the instance provisioned by the user. - * - * @param project the project value to set. - * @return the InfoField object itself. - */ - public InfoField withProject(String project) { - this.project = project; - 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/MeterInfo.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MeterInfo.java deleted file mode 100644 index 59d2a3070088..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MeterInfo.java +++ /dev/null @@ -1,300 +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.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -/** Detailed information about the meter. */ -@Fluent -public final class MeterInfo { - /* - * The unique identifier of the resource. - */ - @JsonProperty(value = "MeterId") - private UUID meterId; - - /* - * The name of the meter, within the given meter category - */ - @JsonProperty(value = "MeterName") - private String meterName; - - /* - * The category of the meter, e.g., 'Cloud services', 'Networking', etc.. - */ - @JsonProperty(value = "MeterCategory") - private String meterCategory; - - /* - * The subcategory of the meter, e.g., 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. - */ - @JsonProperty(value = "MeterSubCategory") - private String meterSubCategory; - - /* - * The unit in which the meter consumption is charged, e.g., 'Hours', 'GB', etc. - */ - @JsonProperty(value = "Unit") - private String unit; - - /* - * Provides additional meter data. 'Third Party' indicates a meter with no discount. Blanks indicate First Party. - */ - @JsonProperty(value = "MeterTags") - private List meterTags; - - /* - * The region in which the Azure service is available. - */ - @JsonProperty(value = "MeterRegion") - private String meterRegion; - - /* - * The list of key/value pairs for the meter rates, in the format 'key':'value' where key = the meter quantity, and - * value = the corresponding price - */ - @JsonProperty(value = "MeterRates") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) - private Map meterRates; - - /* - * Indicates the date from which the meter rate is effective. - */ - @JsonProperty(value = "EffectiveDate") - private OffsetDateTime effectiveDate; - - /* - * The resource quantity that is included in the offer at no cost. Consumption beyond this quantity will be - * charged. - */ - @JsonProperty(value = "IncludedQuantity") - private Float includedQuantity; - - /** Creates an instance of MeterInfo class. */ - public MeterInfo() { - } - - /** - * Get the meterId property: The unique identifier of the resource. - * - * @return the meterId value. - */ - public UUID meterId() { - return this.meterId; - } - - /** - * Set the meterId property: The unique identifier of the resource. - * - * @param meterId the meterId value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withMeterId(UUID meterId) { - this.meterId = meterId; - return this; - } - - /** - * Get the meterName property: The name of the meter, within the given meter category. - * - * @return the meterName value. - */ - public String meterName() { - return this.meterName; - } - - /** - * Set the meterName property: The name of the meter, within the given meter category. - * - * @param meterName the meterName value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withMeterName(String meterName) { - this.meterName = meterName; - return this; - } - - /** - * Get the meterCategory property: The category of the meter, e.g., 'Cloud services', 'Networking', etc.. - * - * @return the meterCategory value. - */ - public String meterCategory() { - return this.meterCategory; - } - - /** - * Set the meterCategory property: The category of the meter, e.g., 'Cloud services', 'Networking', etc.. - * - * @param meterCategory the meterCategory value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withMeterCategory(String meterCategory) { - this.meterCategory = meterCategory; - return this; - } - - /** - * Get the meterSubCategory property: The subcategory of the meter, e.g., 'A6 Cloud services', 'ExpressRoute (IXP)', - * etc.. - * - * @return the meterSubCategory value. - */ - public String meterSubCategory() { - return this.meterSubCategory; - } - - /** - * Set the meterSubCategory property: The subcategory of the meter, e.g., 'A6 Cloud services', 'ExpressRoute (IXP)', - * etc.. - * - * @param meterSubCategory the meterSubCategory value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withMeterSubCategory(String meterSubCategory) { - this.meterSubCategory = meterSubCategory; - return this; - } - - /** - * Get the unit property: The unit in which the meter consumption is charged, e.g., 'Hours', 'GB', etc. - * - * @return the unit value. - */ - public String unit() { - return this.unit; - } - - /** - * Set the unit property: The unit in which the meter consumption is charged, e.g., 'Hours', 'GB', etc. - * - * @param unit the unit value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withUnit(String unit) { - this.unit = unit; - return this; - } - - /** - * Get the meterTags property: Provides additional meter data. 'Third Party' indicates a meter with no discount. - * Blanks indicate First Party. - * - * @return the meterTags value. - */ - public List meterTags() { - return this.meterTags; - } - - /** - * Set the meterTags property: Provides additional meter data. 'Third Party' indicates a meter with no discount. - * Blanks indicate First Party. - * - * @param meterTags the meterTags value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withMeterTags(List meterTags) { - this.meterTags = meterTags; - return this; - } - - /** - * Get the meterRegion property: The region in which the Azure service is available. - * - * @return the meterRegion value. - */ - public String meterRegion() { - return this.meterRegion; - } - - /** - * Set the meterRegion property: The region in which the Azure service is available. - * - * @param meterRegion the meterRegion value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withMeterRegion(String meterRegion) { - this.meterRegion = meterRegion; - return this; - } - - /** - * Get the meterRates property: The list of key/value pairs for the meter rates, in the format 'key':'value' where - * key = the meter quantity, and value = the corresponding price. - * - * @return the meterRates value. - */ - public Map meterRates() { - return this.meterRates; - } - - /** - * Set the meterRates property: The list of key/value pairs for the meter rates, in the format 'key':'value' where - * key = the meter quantity, and value = the corresponding price. - * - * @param meterRates the meterRates value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withMeterRates(Map meterRates) { - this.meterRates = meterRates; - return this; - } - - /** - * Get the effectiveDate property: Indicates the date from which the meter rate is effective. - * - * @return the effectiveDate value. - */ - public OffsetDateTime effectiveDate() { - return this.effectiveDate; - } - - /** - * Set the effectiveDate property: Indicates the date from which the meter rate is effective. - * - * @param effectiveDate the effectiveDate value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withEffectiveDate(OffsetDateTime effectiveDate) { - this.effectiveDate = effectiveDate; - return this; - } - - /** - * Get the includedQuantity property: The resource quantity that is included in the offer at no cost. Consumption - * beyond this quantity will be charged. - * - * @return the includedQuantity value. - */ - public Float includedQuantity() { - return this.includedQuantity; - } - - /** - * Set the includedQuantity property: The resource quantity that is included in the offer at no cost. Consumption - * beyond this quantity will be charged. - * - * @param includedQuantity the includedQuantity value to set. - * @return the MeterInfo object itself. - */ - public MeterInfo withIncludedQuantity(Float includedQuantity) { - this.includedQuantity = includedQuantity; - 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/MonetaryCommitment.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCommitment.java deleted file mode 100644 index 28e5754f6586..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCommitment.java +++ /dev/null @@ -1,101 +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.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import java.math.BigDecimal; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -/** Indicates that a monetary commitment is required for this offer. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "Name") -@JsonTypeName("Monetary Commitment") -@Fluent -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 percentage. This field is used only by offer terms of type 'Monetary Commitment'. - */ - @JsonProperty(value = "TieredDiscount") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) - private Map tieredDiscount; - - /* - * An array of meter ids that are excluded from the given offer terms. - */ - @JsonProperty(value = "ExcludedMeterIds") - private List excludedMeterIds; - - /** Creates an instance of MonetaryCommitment class. */ - public MonetaryCommitment() { - } - - /** - * Get the tieredDiscount property: The list of key/value pairs for the tiered meter rates, in the format - * 'key':'value' where key = price, and value = the corresponding discount percentage. This field is used only by - * offer terms of type 'Monetary Commitment'. - * - * @return the tieredDiscount value. - */ - public Map tieredDiscount() { - return this.tieredDiscount; - } - - /** - * Set the tieredDiscount property: The list of key/value pairs for the tiered meter rates, in the format - * 'key':'value' where key = price, and value = the corresponding discount percentage. This field is used only by - * offer terms of type 'Monetary Commitment'. - * - * @param tieredDiscount the tieredDiscount value to set. - * @return the MonetaryCommitment object itself. - */ - public MonetaryCommitment withTieredDiscount(Map tieredDiscount) { - this.tieredDiscount = tieredDiscount; - return this; - } - - /** - * Get the excludedMeterIds property: An array of meter ids that are excluded from the given offer terms. - * - * @return the excludedMeterIds value. - */ - public List excludedMeterIds() { - return this.excludedMeterIds; - } - - /** - * Set the excludedMeterIds property: An array of meter ids that are excluded from the given offer terms. - * - * @param excludedMeterIds the excludedMeterIds value to set. - * @return the MonetaryCommitment object itself. - */ - public MonetaryCommitment withExcludedMeterIds(List excludedMeterIds) { - this.excludedMeterIds = excludedMeterIds; - return this; - } - - /** {@inheritDoc} */ - @Override - public MonetaryCommitment withEffectiveDate(OffsetDateTime effectiveDate) { - super.withEffectiveDate(effectiveDate); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - super.validate(); - } -} 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 deleted file mode 100644 index 2266cf0c781c..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/MonetaryCredit.java +++ /dev/null @@ -1,93 +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.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import java.math.BigDecimal; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.UUID; - -/** Indicates that this is a monetary credit offer. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "Name") -@JsonTypeName("Monetary Credit") -@Fluent -public final class MonetaryCredit extends OfferTermInfoAutoGenerated { - /* - * The amount of credit provided under the terms of the given offer level. - */ - @JsonProperty(value = "Credit") - private BigDecimal credit; - - /* - * An array of meter ids that are excluded from the given offer terms. - */ - @JsonProperty(value = "ExcludedMeterIds") - private List excludedMeterIds; - - /** Creates an instance of MonetaryCredit class. */ - public MonetaryCredit() { - } - - /** - * Get the credit property: The amount of credit provided under the terms of the given offer level. - * - * @return the credit value. - */ - public BigDecimal credit() { - return this.credit; - } - - /** - * Set the credit property: The amount of credit provided under the terms of the given offer level. - * - * @param credit the credit value to set. - * @return the MonetaryCredit object itself. - */ - public MonetaryCredit withCredit(BigDecimal credit) { - this.credit = credit; - return this; - } - - /** - * Get the excludedMeterIds property: An array of meter ids that are excluded from the given offer terms. - * - * @return the excludedMeterIds value. - */ - public List excludedMeterIds() { - return this.excludedMeterIds; - } - - /** - * Set the excludedMeterIds property: An array of meter ids that are excluded from the given offer terms. - * - * @param excludedMeterIds the excludedMeterIds value to set. - * @return the MonetaryCredit object itself. - */ - public MonetaryCredit withExcludedMeterIds(List excludedMeterIds) { - this.excludedMeterIds = excludedMeterIds; - return this; - } - - /** {@inheritDoc} */ - @Override - public MonetaryCredit withEffectiveDate(OffsetDateTime effectiveDate) { - super.withEffectiveDate(effectiveDate); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - super.validate(); - } -} 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 deleted file mode 100644 index ef051afce21e..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfo.java +++ /dev/null @@ -1,54 +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; - -/** Name of the offer term. */ -public enum OfferTermInfo { - /** 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 OfferTermInfo instance. */ - private final String value; - - OfferTermInfo(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a OfferTermInfo instance. - * - * @param value the serialized value to parse. - * @return the parsed OfferTermInfo object, or null if unable to parse. - */ - @JsonCreator - public static OfferTermInfo fromString(String value) { - if (value == null) { - return null; - } - OfferTermInfo[] items = OfferTermInfo.values(); - for (OfferTermInfo item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** {@inheritDoc} */ - @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 deleted file mode 100644 index 6a57799bceff..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/OfferTermInfoAutoGenerated.java +++ /dev/null @@ -1,65 +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.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; - - /** Creates an instance of OfferTermInfoAutoGenerated class. */ - public OfferTermInfoAutoGenerated() { - } - - /** - * 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/RateCards.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RateCards.java deleted file mode 100644 index 9b68139892b4..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RateCards.java +++ /dev/null @@ -1,48 +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.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** Resource collection API of RateCards. */ -public interface RateCards { - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return price and Metadata information for resources along with {@link Response}. - */ - Response getWithResponse(String filter, Context context); - - /** - * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, - * Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to - * service names, types, resources, units of measure, and regions, is subject to change at any time and without - * notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to - * uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing - * model, you will be notified in advance of the change. - * - * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this - * time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part - * of the $filter. - * @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. - */ - ResourceRateCardInfo get(String filter); -} 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 deleted file mode 100644 index 9cafd536844e..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/RecurringCharge.java +++ /dev/null @@ -1,64 +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.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import java.time.OffsetDateTime; - -/** Indicates a recurring charge is present for this offer. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "Name") -@JsonTypeName("Recurring Charge") -@Fluent -public final class RecurringCharge extends OfferTermInfoAutoGenerated { - /* - * The amount of recurring charge as per the offer term. - */ - @JsonProperty(value = "RecurringCharge") - private Integer recurringCharge; - - /** Creates an instance of RecurringCharge class. */ - public RecurringCharge() { - } - - /** - * Get the recurringCharge property: The amount of recurring charge as per the offer term. - * - * @return the recurringCharge value. - */ - public Integer recurringCharge() { - return this.recurringCharge; - } - - /** - * Set the recurringCharge property: The amount of recurring charge as per the offer term. - * - * @param recurringCharge the recurringCharge value to set. - * @return the RecurringCharge object itself. - */ - public RecurringCharge withRecurringCharge(Integer recurringCharge) { - this.recurringCharge = recurringCharge; - return this; - } - - /** {@inheritDoc} */ - @Override - public RecurringCharge withEffectiveDate(OffsetDateTime effectiveDate) { - super.withEffectiveDate(effectiveDate); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - super.validate(); - } -} 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 deleted file mode 100644 index bd7ccdb02ea3..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/ResourceRateCardInfo.java +++ /dev/null @@ -1,53 +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.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; -import java.util.List; - -/** An immutable client-side representation of ResourceRateCardInfo. */ -public interface ResourceRateCardInfo { - /** - * Gets the currency property: The currency in which the rates are provided. - * - * @return the currency value. - */ - String currency(); - - /** - * Gets the locale property: The culture in which the resource information is localized. - * - * @return the locale value. - */ - String locale(); - - /** - * Gets the isTaxIncluded property: All rates are pretax, so this will always be returned as 'false'. - * - * @return the isTaxIncluded value. - */ - Boolean isTaxIncluded(); - - /** - * Gets the offerTerms property: A list of offer terms. - * - * @return the offerTerms value. - */ - List offerTerms(); - - /** - * Gets the meters property: A list of meters. - * - * @return the meters value. - */ - List meters(); - - /** - * Gets the inner com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner object. - * - * @return the inner object. - */ - ResourceRateCardInfoInner innerModel(); -} 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 deleted file mode 100644 index 5ae95531a338..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregates.java +++ /dev/null @@ -1,53 +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.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import java.time.OffsetDateTime; - -/** Resource collection API of UsageAggregates. */ -public interface UsageAggregates { - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @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 as paginated response with {@link PagedIterable}. - */ - PagedIterable list(OffsetDateTime reportedStartTime, OffsetDateTime reportedEndTime); - - /** - * Query aggregated Azure subscription consumption data for a date range. - * - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. - * @param showDetails `True` returns usage data in instance-level detail, `false` causes server-side aggregation - * with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for - * website consumption. If you specify showDetails = false, the data will be aggregated as a single line item - * for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and - * usageEndTime). - * @param aggregationGranularity `Daily` (default) returns the data in daily granularity, `Hourly` returns the data - * in hourly granularity. - * @param continuationToken Used when a continuation token string is provided in the response body of the previous - * call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of - * the day/hour (based on the granularity) passed in. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Get UsageAggregates operation response as paginated response with {@link PagedIterable}. - */ - PagedIterable list( - OffsetDateTime reportedStartTime, - OffsetDateTime reportedEndTime, - Boolean showDetails, - AggregationGranularity aggregationGranularity, - String continuationToken, - Context context); -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregation.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregation.java deleted file mode 100644 index 2daec73cec80..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregation.java +++ /dev/null @@ -1,124 +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.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import java.time.OffsetDateTime; -import java.util.UUID; - -/** An immutable client-side representation of UsageAggregation. */ -public interface UsageAggregation { - /** - * Gets the id property: Unique Id for the usage aggregate. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: Name of the usage aggregate. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: Type of the resource being returned. - * - * @return the type value. - */ - String type(); - - /** - * Gets the subscriptionId property: The subscription identifier for the Azure user. - * - * @return the subscriptionId value. - */ - UUID subscriptionId(); - - /** - * Gets the meterId property: Unique ID for the resource that was consumed (aka ResourceID). - * - * @return the meterId value. - */ - String meterId(); - - /** - * Gets the usageStartTime property: UTC start time for the usage bucket to which this usage aggregate belongs. - * - * @return the usageStartTime value. - */ - OffsetDateTime usageStartTime(); - - /** - * Gets the usageEndTime property: UTC end time for the usage bucket to which this usage aggregate belongs. - * - * @return the usageEndTime value. - */ - OffsetDateTime usageEndTime(); - - /** - * Gets the quantity property: The amount of the resource consumption that occurred in this time frame. - * - * @return the quantity value. - */ - Float quantity(); - - /** - * Gets the unit property: The unit in which the usage for this resource is being counted, e.g. Hours, GB. - * - * @return the unit value. - */ - String unit(); - - /** - * Gets the meterName property: Friendly name of the resource being consumed. - * - * @return the meterName value. - */ - String meterName(); - - /** - * Gets the meterCategory property: Category of the consumed resource. - * - * @return the meterCategory value. - */ - String meterCategory(); - - /** - * Gets the meterSubCategory property: Sub-category of the consumed resource. - * - * @return the meterSubCategory value. - */ - String meterSubCategory(); - - /** - * Gets the meterRegion property: Region of the meterId used for billing purposes. - * - * @return the meterRegion value. - */ - String meterRegion(); - - /** - * Gets the infoFields property: Key-value pairs of instance details (legacy format). - * - * @return the infoFields value. - */ - InfoField infoFields(); - - /** - * Gets the instanceData property: Key-value pairs of instance details represented as a string. - * - * @return the instanceData value. - */ - String instanceData(); - - /** - * Gets the inner com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner object. - * - * @return the inner object. - */ - UsageAggregationInner innerModel(); -} 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 deleted file mode 100644 index eb52cf2d24e2..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/UsageAggregationListResult.java +++ /dev/null @@ -1,81 +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.azure.core.annotation.Fluent; -import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The Get UsageAggregates operation response. */ -@Fluent -public final class UsageAggregationListResult { - /* - * Gets or sets details for the requested aggregation. - */ - @JsonProperty(value = "value") - private List value; - - /* - * Gets or sets the link to the next set of results. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - - /** Creates an instance of UsageAggregationListResult class. */ - public UsageAggregationListResult() { - } - - /** - * Get the value property: Gets or sets details for the requested aggregation. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: Gets or sets details for the requested aggregation. - * - * @param value the value value to set. - * @return the UsageAggregationListResult object itself. - */ - public UsageAggregationListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: Gets or sets the link to the next set of results. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: Gets or sets the link to the next set of results. - * - * @param nextLink the nextLink value to set. - * @return the UsageAggregationListResult object itself. - */ - public UsageAggregationListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/package-info.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/package-info.java deleted file mode 100644 index b65f05b2b621..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/models/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** Package containing the data models for UsageManagementClient. null. */ -package com.azure.resourcemanager.commerce.models; diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/package-info.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/package-info.java deleted file mode 100644 index 1d798fa7015e..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** Package containing the classes for UsageManagementClient. null. */ -package com.azure.resourcemanager.commerce; diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/module-info.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/module-info.java deleted file mode 100644 index 9324bc0805d5..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/module-info.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -module com.azure.resourcemanager.commerce { - requires transitive com.azure.core.management; - - exports com.azure.resourcemanager.commerce; - exports com.azure.resourcemanager.commerce.fluent; - exports com.azure.resourcemanager.commerce.fluent.models; - exports com.azure.resourcemanager.commerce.models; - - opens com.azure.resourcemanager.commerce.fluent.models to - com.azure.core, - com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.commerce.models to - com.azure.core, - com.fasterxml.jackson.databind; -} 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 deleted file mode 100644 index 2fe189ea96f1..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/samples/java/com/azure/resourcemanager/commerce/generated/RateCardGetSamples.java +++ /dev/null @@ -1,24 +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.generated; - -/** 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'", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/InfoFieldTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/InfoFieldTests.java deleted file mode 100644 index ff4414b389b1..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/InfoFieldTests.java +++ /dev/null @@ -1,24 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.InfoField; -import org.junit.jupiter.api.Assertions; - -public final class InfoFieldTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InfoField model = BinaryData.fromString("{\"project\":\"slwejdpvw\"}").toObject(InfoField.class); - Assertions.assertEquals("slwejdpvw", model.project()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InfoField model = new InfoField().withProject("slwejdpvw"); - model = BinaryData.fromObject(model).toObject(InfoField.class); - Assertions.assertEquals("slwejdpvw", model.project()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MeterInfoTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MeterInfoTests.java deleted file mode 100644 index 9c36cdc863fa..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MeterInfoTests.java +++ /dev/null @@ -1,82 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.MeterInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class MeterInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MeterInfo model = - BinaryData - .fromString( - "{\"MeterId\":\"02c5a81b-ee19-4c50-bb4c-6805c59050b2\",\"MeterName\":\"gls\",\"MeterCategory\":\"inqpjwnzll\",\"MeterSubCategory\":\"mppeebvmgxs\",\"Unit\":\"kyqduujit\",\"MeterTags\":[\"zdzevndh\",\"rwpdappdsbdkvwrw\"],\"MeterRegion\":\"eusnhutj\",\"MeterRates\":{\"rl\":33.49618,\"ugjzzdatqxhocdge\":86.19471,\"lgphu\":56.39705,\"cndvkaozwyiftyhx\":89.55463},\"EffectiveDate\":\"2021-01-28T13:33:14Z\",\"IncludedQuantity\":5.188751}") - .toObject(MeterInfo.class); - Assertions.assertEquals(UUID.fromString("02c5a81b-ee19-4c50-bb4c-6805c59050b2"), model.meterId()); - Assertions.assertEquals("gls", model.meterName()); - Assertions.assertEquals("inqpjwnzll", model.meterCategory()); - Assertions.assertEquals("mppeebvmgxs", model.meterSubCategory()); - Assertions.assertEquals("kyqduujit", model.unit()); - Assertions.assertEquals("zdzevndh", model.meterTags().get(0)); - Assertions.assertEquals("eusnhutj", model.meterRegion()); - Assertions.assertEquals(33.49618f, model.meterRates().get("rl")); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-28T13:33:14Z"), model.effectiveDate()); - Assertions.assertEquals(5.188751F, model.includedQuantity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MeterInfo model = - new MeterInfo() - .withMeterId(UUID.fromString("02c5a81b-ee19-4c50-bb4c-6805c59050b2")) - .withMeterName("gls") - .withMeterCategory("inqpjwnzll") - .withMeterSubCategory("mppeebvmgxs") - .withUnit("kyqduujit") - .withMeterTags(Arrays.asList("zdzevndh", "rwpdappdsbdkvwrw")) - .withMeterRegion("eusnhutj") - .withMeterRates( - mapOf( - "rl", - 33.49618f, - "ugjzzdatqxhocdge", - 86.19471f, - "lgphu", - 56.39705f, - "cndvkaozwyiftyhx", - 89.55463f)) - .withEffectiveDate(OffsetDateTime.parse("2021-01-28T13:33:14Z")) - .withIncludedQuantity(5.188751F); - model = BinaryData.fromObject(model).toObject(MeterInfo.class); - Assertions.assertEquals(UUID.fromString("02c5a81b-ee19-4c50-bb4c-6805c59050b2"), model.meterId()); - Assertions.assertEquals("gls", model.meterName()); - Assertions.assertEquals("inqpjwnzll", model.meterCategory()); - Assertions.assertEquals("mppeebvmgxs", model.meterSubCategory()); - Assertions.assertEquals("kyqduujit", model.unit()); - Assertions.assertEquals("zdzevndh", model.meterTags().get(0)); - Assertions.assertEquals("eusnhutj", model.meterRegion()); - Assertions.assertEquals(33.49618f, model.meterRates().get("rl")); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-28T13:33:14Z"), model.effectiveDate()); - Assertions.assertEquals(5.188751F, model.includedQuantity()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCommitmentTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCommitmentTests.java deleted file mode 100644 index 473481fa667a..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCommitmentTests.java +++ /dev/null @@ -1,59 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.MonetaryCommitment; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class MonetaryCommitmentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonetaryCommitment model = - BinaryData - .fromString( - "{\"Name\":\"Monetary" - + " Commitment\",\"TieredDiscount\":{},\"ExcludedMeterIds\":[\"1aa0f45b-4326-4b78-b0fa-9687c4611286\",\"a60e66b9-10f9-4a92-a7aa-2bf3d302a701\",\"c826acba-6f28-454d-aae4-42fa65ea852b\",\"9baf4d39-7eb5-409a-be03-328ec7b54019\"],\"EffectiveDate\":\"2021-06-11T05:03:33Z\"}") - .toObject(MonetaryCommitment.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-11T05:03:33Z"), model.effectiveDate()); - Assertions - .assertEquals(UUID.fromString("1aa0f45b-4326-4b78-b0fa-9687c4611286"), model.excludedMeterIds().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonetaryCommitment model = - new MonetaryCommitment() - .withEffectiveDate(OffsetDateTime.parse("2021-06-11T05:03:33Z")) - .withTieredDiscount(mapOf()) - .withExcludedMeterIds( - Arrays - .asList( - UUID.fromString("1aa0f45b-4326-4b78-b0fa-9687c4611286"), - UUID.fromString("a60e66b9-10f9-4a92-a7aa-2bf3d302a701"), - UUID.fromString("c826acba-6f28-454d-aae4-42fa65ea852b"), - UUID.fromString("9baf4d39-7eb5-409a-be03-328ec7b54019"))); - model = BinaryData.fromObject(model).toObject(MonetaryCommitment.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-11T05:03:33Z"), model.effectiveDate()); - Assertions - .assertEquals(UUID.fromString("1aa0f45b-4326-4b78-b0fa-9687c4611286"), model.excludedMeterIds().get(0)); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCreditTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCreditTests.java deleted file mode 100644 index 778a0ece030d..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCreditTests.java +++ /dev/null @@ -1,43 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.MonetaryCredit; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class MonetaryCreditTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonetaryCredit model = - BinaryData - .fromString( - "{\"Name\":\"Monetary" - + " Credit\",\"ExcludedMeterIds\":[\"ab7692b8-06a7-4e11-81ad-8c3c5575f463\",\"f7a4db67-3ed6-4b5a-a329-21f2a6ac6a4a\"],\"EffectiveDate\":\"2021-07-03T12:16:15Z\"}") - .toObject(MonetaryCredit.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-03T12:16:15Z"), model.effectiveDate()); - Assertions - .assertEquals(UUID.fromString("ab7692b8-06a7-4e11-81ad-8c3c5575f463"), model.excludedMeterIds().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonetaryCredit model = - new MonetaryCredit() - .withEffectiveDate(OffsetDateTime.parse("2021-07-03T12:16:15Z")) - .withExcludedMeterIds( - Arrays - .asList( - UUID.fromString("ab7692b8-06a7-4e11-81ad-8c3c5575f463"), - UUID.fromString("f7a4db67-3ed6-4b5a-a329-21f2a6ac6a4a"))); - model = BinaryData.fromObject(model).toObject(MonetaryCredit.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-03T12:16:15Z"), model.effectiveDate()); - Assertions - .assertEquals(UUID.fromString("ab7692b8-06a7-4e11-81ad-8c3c5575f463"), model.excludedMeterIds().get(0)); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/OfferTermInfoAutoGeneratedTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/OfferTermInfoAutoGeneratedTests.java deleted file mode 100644 index 5b674fc8ad07..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/OfferTermInfoAutoGeneratedTests.java +++ /dev/null @@ -1,29 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.OfferTermInfoAutoGenerated; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class OfferTermInfoAutoGeneratedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OfferTermInfoAutoGenerated model = - BinaryData - .fromString("{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-04-23T06:59:32Z\"}") - .toObject(OfferTermInfoAutoGenerated.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-23T06:59:32Z"), model.effectiveDate()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OfferTermInfoAutoGenerated model = - new OfferTermInfoAutoGenerated().withEffectiveDate(OffsetDateTime.parse("2021-04-23T06:59:32Z")); - model = BinaryData.fromObject(model).toObject(OfferTermInfoAutoGenerated.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-23T06:59:32Z"), model.effectiveDate()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RateCardsGetWithResponseMockTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RateCardsGetWithResponseMockTests.java deleted file mode 100644 index 62831393e8ef..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RateCardsGetWithResponseMockTests.java +++ /dev/null @@ -1,83 +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.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.commerce.UsageManager; -import com.azure.resourcemanager.commerce.models.ResourceRateCardInfo; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class RateCardsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"Currency\":\"ypl\",\"Locale\":\"kbasyypn\",\"IsTaxIncluded\":true,\"OfferTerms\":[{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-11-24T04:31Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-03-24T00:19:08Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-12-07T05:26:51Z\"}],\"Meters\":[{\"MeterId\":\"b3250b1c-d2dd-4892-a595-82de8cc6e56e\",\"MeterName\":\"tynqgoul\",\"MeterCategory\":\"dlikwyqkgfgibma\",\"MeterSubCategory\":\"akeqs\",\"Unit\":\"yb\",\"MeterTags\":[\"e\",\"qytbciq\",\"ouf\",\"mmnkzsmodmgl\"],\"MeterRegion\":\"gpbkwtmut\",\"MeterRates\":{\"ta\":85.38377,\"pwgcuertu\":94.51547,\"dosvqwhbmdgbbjf\":38.05988,\"gmbmbexppbh\":21.297592},\"EffectiveDate\":\"2021-09-17T16:41:16Z\",\"IncludedQuantity\":8.5479145}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - UsageManager manager = - UsageManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ResourceRateCardInfo response = - manager.rateCards().getWithResponse("fkgiawxk", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("ypl", response.currency()); - Assertions.assertEquals("kbasyypn", response.locale()); - Assertions.assertEquals(true, response.isTaxIncluded()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-11-24T04:31Z"), response.offerTerms().get(0).effectiveDate()); - Assertions - .assertEquals(UUID.fromString("b3250b1c-d2dd-4892-a595-82de8cc6e56e"), response.meters().get(0).meterId()); - Assertions.assertEquals("tynqgoul", response.meters().get(0).meterName()); - Assertions.assertEquals("dlikwyqkgfgibma", response.meters().get(0).meterCategory()); - Assertions.assertEquals("akeqs", response.meters().get(0).meterSubCategory()); - Assertions.assertEquals("yb", response.meters().get(0).unit()); - Assertions.assertEquals("e", response.meters().get(0).meterTags().get(0)); - Assertions.assertEquals("gpbkwtmut", response.meters().get(0).meterRegion()); - Assertions.assertEquals(85.38377f, response.meters().get(0).meterRates().get("ta")); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-17T16:41:16Z"), response.meters().get(0).effectiveDate()); - Assertions.assertEquals(8.5479145F, response.meters().get(0).includedQuantity()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RecurringChargeTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RecurringChargeTests.java deleted file mode 100644 index 408ff2154c29..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RecurringChargeTests.java +++ /dev/null @@ -1,35 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.RecurringCharge; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class RecurringChargeTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecurringCharge model = - BinaryData - .fromString( - "{\"Name\":\"Recurring" - + " Charge\",\"RecurringCharge\":1084941449,\"EffectiveDate\":\"2021-01-26T04:33:28Z\"}") - .toObject(RecurringCharge.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-26T04:33:28Z"), model.effectiveDate()); - Assertions.assertEquals(1084941449, model.recurringCharge()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecurringCharge model = - new RecurringCharge() - .withEffectiveDate(OffsetDateTime.parse("2021-01-26T04:33:28Z")) - .withRecurringCharge(1084941449); - model = BinaryData.fromObject(model).toObject(RecurringCharge.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-26T04:33:28Z"), model.effectiveDate()); - Assertions.assertEquals(1084941449, model.recurringCharge()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/ResourceRateCardInfoInnerTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/ResourceRateCardInfoInnerTests.java deleted file mode 100644 index 5764dcde4ee3..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/ResourceRateCardInfoInnerTests.java +++ /dev/null @@ -1,116 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; -import com.azure.resourcemanager.commerce.models.MeterInfo; -import com.azure.resourcemanager.commerce.models.OfferTermInfoAutoGenerated; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class ResourceRateCardInfoInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceRateCardInfoInner model = - BinaryData - .fromString( - "{\"Currency\":\"oqpsoa\",\"Locale\":\"tazak\",\"IsTaxIncluded\":true,\"OfferTerms\":[{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-06-15T07:28:27Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-10-01T21:39:25Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-02-13T07:50:35Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-07-14T10:08:19Z\"}],\"Meters\":[{\"MeterId\":\"21c454b4-9be1-44a4-8275-74ca26236155\",\"MeterName\":\"gexpaojakhmsbz\",\"MeterCategory\":\"crzevdphlx\",\"MeterSubCategory\":\"lthqtrgqjbp\",\"Unit\":\"fsinzgvfcjrwzoxx\",\"MeterTags\":[\"elluwfziton\",\"eqfpj\",\"jlxofpdvhpfxxyp\",\"ninmayhuyb\"],\"MeterRegion\":\"podepoo\",\"MeterRates\":{\"vamih\":94.223724,\"gnarxzxtheo\":92.43863,\"si\":35.96248},\"EffectiveDate\":\"2021-11-04T11:49:42Z\",\"IncludedQuantity\":90.02525},{\"MeterId\":\"7c95010f-59ae-4879-bbc0-077e4df6540f\",\"MeterName\":\"qi\",\"MeterCategory\":\"hungbwjzrnf\",\"MeterSubCategory\":\"xgispemvtzfkufu\",\"Unit\":\"jofxqe\",\"MeterTags\":[\"aeqjhqjbasvms\"],\"MeterRegion\":\"qulngsntnbybkzgc\",\"MeterRates\":{\"lxxwrljdouskc\":57.128227,\"kocrcjdkwtnhx\":70.357445},\"EffectiveDate\":\"2020-12-31T19:07:05Z\",\"IncludedQuantity\":30.74364}]}") - .toObject(ResourceRateCardInfoInner.class); - Assertions.assertEquals("oqpsoa", model.currency()); - Assertions.assertEquals("tazak", model.locale()); - Assertions.assertEquals(true, model.isTaxIncluded()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-06-15T07:28:27Z"), model.offerTerms().get(0).effectiveDate()); - Assertions - .assertEquals(UUID.fromString("21c454b4-9be1-44a4-8275-74ca26236155"), model.meters().get(0).meterId()); - Assertions.assertEquals("gexpaojakhmsbz", model.meters().get(0).meterName()); - Assertions.assertEquals("crzevdphlx", model.meters().get(0).meterCategory()); - Assertions.assertEquals("lthqtrgqjbp", model.meters().get(0).meterSubCategory()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.meters().get(0).unit()); - Assertions.assertEquals("elluwfziton", model.meters().get(0).meterTags().get(0)); - Assertions.assertEquals("podepoo", model.meters().get(0).meterRegion()); - Assertions.assertEquals(94.223724f, model.meters().get(0).meterRates().get("vamih")); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T11:49:42Z"), model.meters().get(0).effectiveDate()); - Assertions.assertEquals(90.02525F, model.meters().get(0).includedQuantity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceRateCardInfoInner model = - new ResourceRateCardInfoInner() - .withCurrency("oqpsoa") - .withLocale("tazak") - .withIsTaxIncluded(true) - .withOfferTerms( - Arrays - .asList( - new OfferTermInfoAutoGenerated() - .withEffectiveDate(OffsetDateTime.parse("2021-06-15T07:28:27Z")), - new OfferTermInfoAutoGenerated() - .withEffectiveDate(OffsetDateTime.parse("2021-10-01T21:39:25Z")), - new OfferTermInfoAutoGenerated() - .withEffectiveDate(OffsetDateTime.parse("2021-02-13T07:50:35Z")), - new OfferTermInfoAutoGenerated() - .withEffectiveDate(OffsetDateTime.parse("2021-07-14T10:08:19Z")))) - .withMeters( - Arrays - .asList( - new MeterInfo() - .withMeterId(UUID.fromString("21c454b4-9be1-44a4-8275-74ca26236155")) - .withMeterName("gexpaojakhmsbz") - .withMeterCategory("crzevdphlx") - .withMeterSubCategory("lthqtrgqjbp") - .withUnit("fsinzgvfcjrwzoxx") - .withMeterTags(Arrays.asList("elluwfziton", "eqfpj", "jlxofpdvhpfxxyp", "ninmayhuyb")) - .withMeterRegion("podepoo") - .withMeterRates(mapOf("vamih", 94.223724f, "gnarxzxtheo", 92.43863f, "si", 35.96248f)) - .withEffectiveDate(OffsetDateTime.parse("2021-11-04T11:49:42Z")) - .withIncludedQuantity(90.02525F), - new MeterInfo() - .withMeterId(UUID.fromString("7c95010f-59ae-4879-bbc0-077e4df6540f")) - .withMeterName("qi") - .withMeterCategory("hungbwjzrnf") - .withMeterSubCategory("xgispemvtzfkufu") - .withUnit("jofxqe") - .withMeterTags(Arrays.asList("aeqjhqjbasvms")) - .withMeterRegion("qulngsntnbybkzgc") - .withMeterRates(mapOf("lxxwrljdouskc", 57.128227f, "kocrcjdkwtnhx", 70.357445f)) - .withEffectiveDate(OffsetDateTime.parse("2020-12-31T19:07:05Z")) - .withIncludedQuantity(30.74364F))); - model = BinaryData.fromObject(model).toObject(ResourceRateCardInfoInner.class); - Assertions.assertEquals("oqpsoa", model.currency()); - Assertions.assertEquals("tazak", model.locale()); - Assertions.assertEquals(true, model.isTaxIncluded()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-06-15T07:28:27Z"), model.offerTerms().get(0).effectiveDate()); - Assertions - .assertEquals(UUID.fromString("21c454b4-9be1-44a4-8275-74ca26236155"), model.meters().get(0).meterId()); - Assertions.assertEquals("gexpaojakhmsbz", model.meters().get(0).meterName()); - Assertions.assertEquals("crzevdphlx", model.meters().get(0).meterCategory()); - Assertions.assertEquals("lthqtrgqjbp", model.meters().get(0).meterSubCategory()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.meters().get(0).unit()); - Assertions.assertEquals("elluwfziton", model.meters().get(0).meterTags().get(0)); - Assertions.assertEquals("podepoo", model.meters().get(0).meterRegion()); - Assertions.assertEquals(94.223724f, model.meters().get(0).meterRates().get("vamih")); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T11:49:42Z"), model.meters().get(0).effectiveDate()); - Assertions.assertEquals(90.02525F, model.meters().get(0).includedQuantity()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationInnerTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationInnerTests.java deleted file mode 100644 index 8e7696669ab6..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationInnerTests.java +++ /dev/null @@ -1,75 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.azure.resourcemanager.commerce.models.InfoField; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class UsageAggregationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsageAggregationInner model = - BinaryData - .fromString( - "{\"id\":\"git\",\"name\":\"qhabifpikxwcz\",\"type\":\"scnpqxuhivy\",\"properties\":{\"subscriptionId\":\"f6de8516-24e1-45ed-82b6-e06fea31b82a\",\"meterId\":\"b\",\"usageStartTime\":\"2021-06-19T13:57:47Z\",\"usageEndTime\":\"2021-06-14T11:48:10Z\",\"quantity\":69.25819,\"unit\":\"mjgr\",\"meterName\":\"wvukx\",\"meterCategory\":\"udccsnhsjc\",\"meterSubCategory\":\"ejhkry\",\"meterRegion\":\"napczwlokjy\",\"infoFields\":{\"project\":\"kvnipjoxz\"},\"instanceData\":\"chgejspodm\"}}") - .toObject(UsageAggregationInner.class); - Assertions.assertEquals("git", model.id()); - Assertions.assertEquals("qhabifpikxwcz", model.name()); - Assertions.assertEquals("scnpqxuhivy", model.type()); - Assertions.assertEquals(UUID.fromString("f6de8516-24e1-45ed-82b6-e06fea31b82a"), model.subscriptionId()); - Assertions.assertEquals("b", model.meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-19T13:57:47Z"), model.usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-14T11:48:10Z"), model.usageEndTime()); - Assertions.assertEquals(69.25819F, model.quantity()); - Assertions.assertEquals("mjgr", model.unit()); - Assertions.assertEquals("wvukx", model.meterName()); - Assertions.assertEquals("udccsnhsjc", model.meterCategory()); - Assertions.assertEquals("ejhkry", model.meterSubCategory()); - Assertions.assertEquals("napczwlokjy", model.meterRegion()); - Assertions.assertEquals("kvnipjoxz", model.infoFields().project()); - Assertions.assertEquals("chgejspodm", model.instanceData()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsageAggregationInner model = - new UsageAggregationInner() - .withId("git") - .withName("qhabifpikxwcz") - .withType("scnpqxuhivy") - .withSubscriptionId(UUID.fromString("f6de8516-24e1-45ed-82b6-e06fea31b82a")) - .withMeterId("b") - .withUsageStartTime(OffsetDateTime.parse("2021-06-19T13:57:47Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-06-14T11:48:10Z")) - .withQuantity(69.25819F) - .withUnit("mjgr") - .withMeterName("wvukx") - .withMeterCategory("udccsnhsjc") - .withMeterSubCategory("ejhkry") - .withMeterRegion("napczwlokjy") - .withInfoFields(new InfoField().withProject("kvnipjoxz")) - .withInstanceData("chgejspodm"); - model = BinaryData.fromObject(model).toObject(UsageAggregationInner.class); - Assertions.assertEquals("git", model.id()); - Assertions.assertEquals("qhabifpikxwcz", model.name()); - Assertions.assertEquals("scnpqxuhivy", model.type()); - Assertions.assertEquals(UUID.fromString("f6de8516-24e1-45ed-82b6-e06fea31b82a"), model.subscriptionId()); - Assertions.assertEquals("b", model.meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-19T13:57:47Z"), model.usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-14T11:48:10Z"), model.usageEndTime()); - Assertions.assertEquals(69.25819F, model.quantity()); - Assertions.assertEquals("mjgr", model.unit()); - Assertions.assertEquals("wvukx", model.meterName()); - Assertions.assertEquals("udccsnhsjc", model.meterCategory()); - Assertions.assertEquals("ejhkry", model.meterSubCategory()); - Assertions.assertEquals("napczwlokjy", model.meterRegion()); - Assertions.assertEquals("kvnipjoxz", model.infoFields().project()); - Assertions.assertEquals("chgejspodm", model.instanceData()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationListResultTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationListResultTests.java deleted file mode 100644 index b482c8c79d11..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationListResultTests.java +++ /dev/null @@ -1,114 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.azure.resourcemanager.commerce.models.UsageAggregationListResult; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class UsageAggregationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsageAggregationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"id\":\"quvgjxpybczme\",\"name\":\"tzopbsphrupidgsy\",\"type\":\"ejhphoyc\",\"properties\":{\"subscriptionId\":\"99348804-291c-4340-9004-5c0e38008bae\",\"meterId\":\"obhdxbmtqioqjze\",\"usageStartTime\":\"2021-01-14T01:11:27Z\",\"usageEndTime\":\"2021-03-02T03:48:42Z\",\"quantity\":6.097913,\"unit\":\"wnoi\",\"meterName\":\"wlrxyb\",\"meterCategory\":\"oqijgkdmbpaz\",\"meterSubCategory\":\"bc\",\"meterRegion\":\"pdznrbtcqqjnqgl\",\"instanceData\":\"nufo\"}},{\"id\":\"jywif\",\"name\":\"esaagdfm\",\"type\":\"zlhjxrifkwmrvkt\",\"properties\":{\"subscriptionId\":\"1c9a61f5-07a2-48b5-a039-b38ffa691c18\",\"meterId\":\"to\",\"usageStartTime\":\"2021-11-17T06:57:14Z\",\"usageEndTime\":\"2021-01-23T08:07:58Z\",\"quantity\":42.458458,\"unit\":\"psqucmpoyf\",\"meterName\":\"fogknygjofjdde\",\"meterCategory\":\"rd\",\"meterSubCategory\":\"pewnw\",\"meterRegion\":\"itjz\",\"instanceData\":\"usarhmofc\"}},{\"id\":\"smy\",\"name\":\"kdtmlxhekuk\",\"type\":\"txukcdmp\",\"properties\":{\"subscriptionId\":\"cf09efcc-695d-425b-b772-a9f354d422c6\",\"meterId\":\"y\",\"usageStartTime\":\"2021-11-03T04:50:08Z\",\"usageEndTime\":\"2021-03-23T07:07:23Z\",\"quantity\":80.46482,\"unit\":\"dxtayrlhm\",\"meterName\":\"fp\",\"meterCategory\":\"qobmtukk\",\"meterSubCategory\":\"yrtih\",\"meterRegion\":\"tijbpzvgnwzsymgl\",\"instanceData\":\"cyzkohdbihanuf\"}}],\"nextLink\":\"cbjy\"}") - .toObject(UsageAggregationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).id()); - Assertions.assertEquals("tzopbsphrupidgsy", model.value().get(0).name()); - Assertions.assertEquals("ejhphoyc", model.value().get(0).type()); - Assertions - .assertEquals( - UUID.fromString("99348804-291c-4340-9004-5c0e38008bae"), model.value().get(0).subscriptionId()); - Assertions.assertEquals("obhdxbmtqioqjze", model.value().get(0).meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-14T01:11:27Z"), model.value().get(0).usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-02T03:48:42Z"), model.value().get(0).usageEndTime()); - Assertions.assertEquals(6.097913F, model.value().get(0).quantity()); - Assertions.assertEquals("wnoi", model.value().get(0).unit()); - Assertions.assertEquals("wlrxyb", model.value().get(0).meterName()); - Assertions.assertEquals("oqijgkdmbpaz", model.value().get(0).meterCategory()); - Assertions.assertEquals("bc", model.value().get(0).meterSubCategory()); - Assertions.assertEquals("pdznrbtcqqjnqgl", model.value().get(0).meterRegion()); - Assertions.assertEquals("nufo", model.value().get(0).instanceData()); - Assertions.assertEquals("cbjy", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsageAggregationListResult model = - new UsageAggregationListResult() - .withValue( - Arrays - .asList( - new UsageAggregationInner() - .withId("quvgjxpybczme") - .withName("tzopbsphrupidgsy") - .withType("ejhphoyc") - .withSubscriptionId(UUID.fromString("99348804-291c-4340-9004-5c0e38008bae")) - .withMeterId("obhdxbmtqioqjze") - .withUsageStartTime(OffsetDateTime.parse("2021-01-14T01:11:27Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-03-02T03:48:42Z")) - .withQuantity(6.097913F) - .withUnit("wnoi") - .withMeterName("wlrxyb") - .withMeterCategory("oqijgkdmbpaz") - .withMeterSubCategory("bc") - .withMeterRegion("pdznrbtcqqjnqgl") - .withInstanceData("nufo"), - new UsageAggregationInner() - .withId("jywif") - .withName("esaagdfm") - .withType("zlhjxrifkwmrvkt") - .withSubscriptionId(UUID.fromString("1c9a61f5-07a2-48b5-a039-b38ffa691c18")) - .withMeterId("to") - .withUsageStartTime(OffsetDateTime.parse("2021-11-17T06:57:14Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-01-23T08:07:58Z")) - .withQuantity(42.458458F) - .withUnit("psqucmpoyf") - .withMeterName("fogknygjofjdde") - .withMeterCategory("rd") - .withMeterSubCategory("pewnw") - .withMeterRegion("itjz") - .withInstanceData("usarhmofc"), - new UsageAggregationInner() - .withId("smy") - .withName("kdtmlxhekuk") - .withType("txukcdmp") - .withSubscriptionId(UUID.fromString("cf09efcc-695d-425b-b772-a9f354d422c6")) - .withMeterId("y") - .withUsageStartTime(OffsetDateTime.parse("2021-11-03T04:50:08Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-03-23T07:07:23Z")) - .withQuantity(80.46482F) - .withUnit("dxtayrlhm") - .withMeterName("fp") - .withMeterCategory("qobmtukk") - .withMeterSubCategory("yrtih") - .withMeterRegion("tijbpzvgnwzsymgl") - .withInstanceData("cyzkohdbihanuf"))) - .withNextLink("cbjy"); - model = BinaryData.fromObject(model).toObject(UsageAggregationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).id()); - Assertions.assertEquals("tzopbsphrupidgsy", model.value().get(0).name()); - Assertions.assertEquals("ejhphoyc", model.value().get(0).type()); - Assertions - .assertEquals( - UUID.fromString("99348804-291c-4340-9004-5c0e38008bae"), model.value().get(0).subscriptionId()); - Assertions.assertEquals("obhdxbmtqioqjze", model.value().get(0).meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-14T01:11:27Z"), model.value().get(0).usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-02T03:48:42Z"), model.value().get(0).usageEndTime()); - Assertions.assertEquals(6.097913F, model.value().get(0).quantity()); - Assertions.assertEquals("wnoi", model.value().get(0).unit()); - Assertions.assertEquals("wlrxyb", model.value().get(0).meterName()); - Assertions.assertEquals("oqijgkdmbpaz", model.value().get(0).meterCategory()); - Assertions.assertEquals("bc", model.value().get(0).meterSubCategory()); - Assertions.assertEquals("pdznrbtcqqjnqgl", model.value().get(0).meterRegion()); - Assertions.assertEquals("nufo", model.value().get(0).instanceData()); - Assertions.assertEquals("cbjy", model.nextLink()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageSampleTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageSampleTests.java deleted file mode 100644 index 4055b1d4dee8..000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageSampleTests.java +++ /dev/null @@ -1,66 +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.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.fluent.models.UsageSample; -import com.azure.resourcemanager.commerce.models.InfoField; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class UsageSampleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsageSample model = - BinaryData - .fromString( - "{\"subscriptionId\":\"31f9d37f-ba99-4b53-b5f1-186a76a93523\",\"meterId\":\"zyde\",\"usageStartTime\":\"2021-05-18T09:45:02Z\",\"usageEndTime\":\"2021-05-10T11:45:10Z\",\"quantity\":57.05146,\"unit\":\"xinpmqnjaq\",\"meterName\":\"xj\",\"meterCategory\":\"r\",\"meterSubCategory\":\"vcputegj\",\"meterRegion\":\"mfdatscmdvpj\",\"infoFields\":{\"project\":\"suuv\"},\"instanceData\":\"jozkrwfndiod\"}") - .toObject(UsageSample.class); - Assertions.assertEquals(UUID.fromString("31f9d37f-ba99-4b53-b5f1-186a76a93523"), model.subscriptionId()); - Assertions.assertEquals("zyde", model.meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T09:45:02Z"), model.usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-10T11:45:10Z"), model.usageEndTime()); - Assertions.assertEquals(57.05146F, model.quantity()); - Assertions.assertEquals("xinpmqnjaq", model.unit()); - Assertions.assertEquals("xj", model.meterName()); - Assertions.assertEquals("r", model.meterCategory()); - Assertions.assertEquals("vcputegj", model.meterSubCategory()); - Assertions.assertEquals("mfdatscmdvpj", model.meterRegion()); - Assertions.assertEquals("suuv", model.infoFields().project()); - Assertions.assertEquals("jozkrwfndiod", model.instanceData()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsageSample model = - new UsageSample() - .withSubscriptionId(UUID.fromString("31f9d37f-ba99-4b53-b5f1-186a76a93523")) - .withMeterId("zyde") - .withUsageStartTime(OffsetDateTime.parse("2021-05-18T09:45:02Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-05-10T11:45:10Z")) - .withQuantity(57.05146F) - .withUnit("xinpmqnjaq") - .withMeterName("xj") - .withMeterCategory("r") - .withMeterSubCategory("vcputegj") - .withMeterRegion("mfdatscmdvpj") - .withInfoFields(new InfoField().withProject("suuv")) - .withInstanceData("jozkrwfndiod"); - model = BinaryData.fromObject(model).toObject(UsageSample.class); - Assertions.assertEquals(UUID.fromString("31f9d37f-ba99-4b53-b5f1-186a76a93523"), model.subscriptionId()); - Assertions.assertEquals("zyde", model.meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T09:45:02Z"), model.usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-10T11:45:10Z"), model.usageEndTime()); - Assertions.assertEquals(57.05146F, model.quantity()); - Assertions.assertEquals("xinpmqnjaq", model.unit()); - Assertions.assertEquals("xj", model.meterName()); - Assertions.assertEquals("r", model.meterCategory()); - Assertions.assertEquals("vcputegj", model.meterSubCategory()); - Assertions.assertEquals("mfdatscmdvpj", model.meterRegion()); - Assertions.assertEquals("suuv", model.infoFields().project()); - Assertions.assertEquals("jozkrwfndiod", model.instanceData()); - } -}