diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 90aecf6b32a62..607d60e034198 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -185,6 +185,7 @@ com.azure.resourcemanager:azure-resourcemanager-recoveryservices;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-consumption;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index b80dac967d8f2..63aff9367c763 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ sdk/boms sdk/cognitiveservices sdk/communication + sdk/consumption sdk/core sdk/cosmos sdk/costmanagement diff --git a/sdk/consumption/azure-resourcemanager-consumption/CHANGELOG.md b/sdk/consumption/azure-resourcemanager-consumption/CHANGELOG.md new file mode 100644 index 0000000000000..166aa69fe7cdb --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-22) + +- Azure Resource Manager Consumption client library for Java. This package contains Microsoft Azure SDK for Consumption Management SDK. Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. Package tag package-2019-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/consumption/azure-resourcemanager-consumption/README.md b/sdk/consumption/azure-resourcemanager-consumption/README.md new file mode 100644 index 0000000000000..f739d39ad7b6e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager Consumption client library for Java + +Azure Resource Manager Consumption client library for Java. + +This package contains Microsoft Azure SDK for Consumption Management SDK. Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. Package tag package-2019-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-consumption;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-consumption + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ConsumptionManager manager = ConsumptionManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/consumption/azure-resourcemanager-consumption/pom.xml b/sdk/consumption/azure-resourcemanager-consumption/pom.xml new file mode 100644 index 0000000000000..cde485f5c783d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-consumption + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Consumption Management + This package contains Microsoft Azure SDK for Consumption Management SDK. Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. Package tag package-2019-10. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/ConsumptionManager.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/ConsumptionManager.java new file mode 100644 index 0000000000000..59206f02213b9 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/ConsumptionManager.java @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption; + +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.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.ConsumptionManagementClient; +import com.azure.resourcemanager.consumption.implementation.AggregatedCostsImpl; +import com.azure.resourcemanager.consumption.implementation.BalancesImpl; +import com.azure.resourcemanager.consumption.implementation.BudgetsImpl; +import com.azure.resourcemanager.consumption.implementation.ChargesImpl; +import com.azure.resourcemanager.consumption.implementation.ConsumptionManagementClientBuilder; +import com.azure.resourcemanager.consumption.implementation.CreditsImpl; +import com.azure.resourcemanager.consumption.implementation.EventsOperationsImpl; +import com.azure.resourcemanager.consumption.implementation.ForecastsImpl; +import com.azure.resourcemanager.consumption.implementation.LotsOperationsImpl; +import com.azure.resourcemanager.consumption.implementation.MarketplacesImpl; +import com.azure.resourcemanager.consumption.implementation.OperationsImpl; +import com.azure.resourcemanager.consumption.implementation.PriceSheetsImpl; +import com.azure.resourcemanager.consumption.implementation.ReservationRecommendationDetailsImpl; +import com.azure.resourcemanager.consumption.implementation.ReservationRecommendationsImpl; +import com.azure.resourcemanager.consumption.implementation.ReservationTransactionsImpl; +import com.azure.resourcemanager.consumption.implementation.ReservationsDetailsImpl; +import com.azure.resourcemanager.consumption.implementation.ReservationsSummariesImpl; +import com.azure.resourcemanager.consumption.implementation.TagsImpl; +import com.azure.resourcemanager.consumption.implementation.UsageDetailsImpl; +import com.azure.resourcemanager.consumption.models.AggregatedCosts; +import com.azure.resourcemanager.consumption.models.Balances; +import com.azure.resourcemanager.consumption.models.Budgets; +import com.azure.resourcemanager.consumption.models.Charges; +import com.azure.resourcemanager.consumption.models.Credits; +import com.azure.resourcemanager.consumption.models.EventsOperations; +import com.azure.resourcemanager.consumption.models.Forecasts; +import com.azure.resourcemanager.consumption.models.LotsOperations; +import com.azure.resourcemanager.consumption.models.Marketplaces; +import com.azure.resourcemanager.consumption.models.Operations; +import com.azure.resourcemanager.consumption.models.PriceSheets; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetails; +import com.azure.resourcemanager.consumption.models.ReservationRecommendations; +import com.azure.resourcemanager.consumption.models.ReservationTransactions; +import com.azure.resourcemanager.consumption.models.ReservationsDetails; +import com.azure.resourcemanager.consumption.models.ReservationsSummaries; +import com.azure.resourcemanager.consumption.models.Tags; +import com.azure.resourcemanager.consumption.models.UsageDetails; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to ConsumptionManager. Consumption management client provides access to consumption resources for Azure + * Enterprise Subscriptions. + */ +public final class ConsumptionManager { + private UsageDetails usageDetails; + + private Marketplaces marketplaces; + + private Budgets budgets; + + private Tags tags; + + private Charges charges; + + private Balances balances; + + private ReservationsSummaries reservationsSummaries; + + private ReservationsDetails reservationsDetails; + + private ReservationRecommendations reservationRecommendations; + + private ReservationRecommendationDetails reservationRecommendationDetails; + + private ReservationTransactions reservationTransactions; + + private PriceSheets priceSheets; + + private Forecasts forecasts; + + private Operations operations; + + private AggregatedCosts aggregatedCosts; + + private EventsOperations eventsOperations; + + private LotsOperations lotsOperations; + + private Credits credits; + + private final ConsumptionManagementClient clientObject; + + private ConsumptionManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ConsumptionManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Consumption service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Consumption service API instance. + */ + public static ConsumptionManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create ConsumptionManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ConsumptionManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + 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; + } + + /** + * 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Consumption service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Consumption service API instance. + */ + public ConsumptionManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.consumption", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ConsumptionManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of UsageDetails. */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(clientObject.getUsageDetails(), this); + } + return usageDetails; + } + + /** @return Resource collection API of Marketplaces. */ + public Marketplaces marketplaces() { + if (this.marketplaces == null) { + this.marketplaces = new MarketplacesImpl(clientObject.getMarketplaces(), this); + } + return marketplaces; + } + + /** @return Resource collection API of Budgets. */ + public Budgets budgets() { + if (this.budgets == null) { + this.budgets = new BudgetsImpl(clientObject.getBudgets(), this); + } + return budgets; + } + + /** @return Resource collection API of Tags. */ + public Tags tags() { + if (this.tags == null) { + this.tags = new TagsImpl(clientObject.getTags(), this); + } + return tags; + } + + /** @return Resource collection API of Charges. */ + public Charges charges() { + if (this.charges == null) { + this.charges = new ChargesImpl(clientObject.getCharges(), this); + } + return charges; + } + + /** @return Resource collection API of Balances. */ + public Balances balances() { + if (this.balances == null) { + this.balances = new BalancesImpl(clientObject.getBalances(), this); + } + return balances; + } + + /** @return Resource collection API of ReservationsSummaries. */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(clientObject.getReservationsSummaries(), this); + } + return reservationsSummaries; + } + + /** @return Resource collection API of ReservationsDetails. */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(clientObject.getReservationsDetails(), this); + } + return reservationsDetails; + } + + /** @return Resource collection API of ReservationRecommendations. */ + public ReservationRecommendations reservationRecommendations() { + if (this.reservationRecommendations == null) { + this.reservationRecommendations = + new ReservationRecommendationsImpl(clientObject.getReservationRecommendations(), this); + } + return reservationRecommendations; + } + + /** @return Resource collection API of ReservationRecommendationDetails. */ + public ReservationRecommendationDetails reservationRecommendationDetails() { + if (this.reservationRecommendationDetails == null) { + this.reservationRecommendationDetails = + new ReservationRecommendationDetailsImpl(clientObject.getReservationRecommendationDetails(), this); + } + return reservationRecommendationDetails; + } + + /** @return Resource collection API of ReservationTransactions. */ + public ReservationTransactions reservationTransactions() { + if (this.reservationTransactions == null) { + this.reservationTransactions = + new ReservationTransactionsImpl(clientObject.getReservationTransactions(), this); + } + return reservationTransactions; + } + + /** @return Resource collection API of PriceSheets. */ + public PriceSheets priceSheets() { + if (this.priceSheets == null) { + this.priceSheets = new PriceSheetsImpl(clientObject.getPriceSheets(), this); + } + return priceSheets; + } + + /** @return Resource collection API of Forecasts. */ + public Forecasts forecasts() { + if (this.forecasts == null) { + this.forecasts = new ForecastsImpl(clientObject.getForecasts(), this); + } + return forecasts; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of AggregatedCosts. */ + public AggregatedCosts aggregatedCosts() { + if (this.aggregatedCosts == null) { + this.aggregatedCosts = new AggregatedCostsImpl(clientObject.getAggregatedCosts(), this); + } + return aggregatedCosts; + } + + /** @return Resource collection API of EventsOperations. */ + public EventsOperations eventsOperations() { + if (this.eventsOperations == null) { + this.eventsOperations = new EventsOperationsImpl(clientObject.getEventsOperations(), this); + } + return eventsOperations; + } + + /** @return Resource collection API of LotsOperations. */ + public LotsOperations lotsOperations() { + if (this.lotsOperations == null) { + this.lotsOperations = new LotsOperationsImpl(clientObject.getLotsOperations(), this); + } + return lotsOperations; + } + + /** @return Resource collection API of Credits. */ + public Credits credits() { + if (this.credits == null) { + this.credits = new CreditsImpl(clientObject.getCredits(), this); + } + return credits; + } + + /** + * @return Wrapped service client ConsumptionManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public ConsumptionManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/AggregatedCostsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/AggregatedCostsClient.java new file mode 100644 index 0000000000000..813767044909a --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/AggregatedCostsClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.ManagementGroupAggregatedCostResultInner; + +/** An instance of this class provides access to all the operations defined in AggregatedCostsClient. */ +public interface AggregatedCostsClient { + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagementGroupAggregatedCostResultInner getByManagementGroup(String managementGroupId); + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param filter May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc + * time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', + * or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByManagementGroupWithResponse( + String managementGroupId, String filter, Context context); + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagementGroupAggregatedCostResultInner getForBillingPeriodByManagementGroup( + String managementGroupId, String billingPeriodName); + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getForBillingPeriodByManagementGroupWithResponse( + String managementGroupId, String billingPeriodName, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/BalancesClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/BalancesClient.java new file mode 100644 index 0000000000000..e21a93426a857 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/BalancesClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.BalanceInner; + +/** An instance of this class provides access to all the operations defined in BalancesClient. */ +public interface BalancesClient { + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BalanceInner getByBillingAccount(String billingAccountId); + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByBillingAccountWithResponse(String billingAccountId, Context context); + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BalanceInner getForBillingPeriodByBillingAccount(String billingAccountId, String billingPeriodName); + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getForBillingPeriodByBillingAccountWithResponse( + String billingAccountId, String billingPeriodName, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/BudgetsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/BudgetsClient.java new file mode 100644 index 0000000000000..c46d390866846 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/BudgetsClient.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.consumption.fluent.models.BudgetInner; + +/** An instance of this class provides access to all the operations defined in BudgetsClient. */ +public interface BudgetsClient { + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing budgets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing budgets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BudgetInner get(String scope, String budgetName); + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String budgetName, Context context); + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require + * eTag. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget 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 a budget resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BudgetInner createOrUpdate(String scope, String budgetName, BudgetInner parameters); + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require + * eTag. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @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 a budget resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String scope, String budgetName, BudgetInner parameters, Context context); + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String budgetName); + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String scope, String budgetName, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ChargesClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ChargesClient.java new file mode 100644 index 0000000000000..58df00d67d608 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ChargesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.ChargesListResultInner; + +/** An instance of this class provides access to all the operations defined in ChargesClient. */ +public interface ChargesClient { + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing charge summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChargesListResultInner list(String scope); + + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param startDate Start date. + * @param endDate End date. + * @param filter May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + * 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param apply May be used to group charges for billingAccount scope by properties/billingProfileId, + * properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by + * properties/invoiceSectionId. + * @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 result of listing charge summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String scope, String startDate, String endDate, String filter, String apply, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ConsumptionManagementClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ConsumptionManagementClient.java new file mode 100644 index 0000000000000..ecf718cfb97f6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ConsumptionManagementClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ConsumptionManagementClient class. */ +public interface ConsumptionManagementClient { + /** + * Gets Azure Subscription ID. + * + * @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 UsageDetailsClient object to access its operations. + * + * @return the UsageDetailsClient object. + */ + UsageDetailsClient getUsageDetails(); + + /** + * Gets the MarketplacesClient object to access its operations. + * + * @return the MarketplacesClient object. + */ + MarketplacesClient getMarketplaces(); + + /** + * Gets the BudgetsClient object to access its operations. + * + * @return the BudgetsClient object. + */ + BudgetsClient getBudgets(); + + /** + * Gets the TagsClient object to access its operations. + * + * @return the TagsClient object. + */ + TagsClient getTags(); + + /** + * Gets the ChargesClient object to access its operations. + * + * @return the ChargesClient object. + */ + ChargesClient getCharges(); + + /** + * Gets the BalancesClient object to access its operations. + * + * @return the BalancesClient object. + */ + BalancesClient getBalances(); + + /** + * Gets the ReservationsSummariesClient object to access its operations. + * + * @return the ReservationsSummariesClient object. + */ + ReservationsSummariesClient getReservationsSummaries(); + + /** + * Gets the ReservationsDetailsClient object to access its operations. + * + * @return the ReservationsDetailsClient object. + */ + ReservationsDetailsClient getReservationsDetails(); + + /** + * Gets the ReservationRecommendationsClient object to access its operations. + * + * @return the ReservationRecommendationsClient object. + */ + ReservationRecommendationsClient getReservationRecommendations(); + + /** + * Gets the ReservationRecommendationDetailsClient object to access its operations. + * + * @return the ReservationRecommendationDetailsClient object. + */ + ReservationRecommendationDetailsClient getReservationRecommendationDetails(); + + /** + * Gets the ReservationTransactionsClient object to access its operations. + * + * @return the ReservationTransactionsClient object. + */ + ReservationTransactionsClient getReservationTransactions(); + + /** + * Gets the PriceSheetsClient object to access its operations. + * + * @return the PriceSheetsClient object. + */ + PriceSheetsClient getPriceSheets(); + + /** + * Gets the ForecastsClient object to access its operations. + * + * @return the ForecastsClient object. + */ + ForecastsClient getForecasts(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AggregatedCostsClient object to access its operations. + * + * @return the AggregatedCostsClient object. + */ + AggregatedCostsClient getAggregatedCosts(); + + /** + * Gets the EventsOperationsClient object to access its operations. + * + * @return the EventsOperationsClient object. + */ + EventsOperationsClient getEventsOperations(); + + /** + * Gets the LotsOperationsClient object to access its operations. + * + * @return the LotsOperationsClient object. + */ + LotsOperationsClient getLotsOperations(); + + /** + * Gets the CreditsClient object to access its operations. + * + * @return the CreditsClient object. + */ + CreditsClient getCredits(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/CreditsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/CreditsClient.java new file mode 100644 index 0000000000000..4a9bba8b64c61 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/CreditsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.CreditSummaryInner; + +/** An instance of this class provides access to all the operations defined in CreditsClient. */ +public interface CreditsClient { + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CreditSummaryInner get(String billingAccountId, String billingProfileId); + + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String billingAccountId, String billingProfileId, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/EventsOperationsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/EventsOperationsClient.java new file mode 100644 index 0000000000000..f1b00fdb33b43 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/EventsOperationsClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.EventSummaryInner; + +/** An instance of this class provides access to all the operations defined in EventsOperationsClient. */ +public interface EventsOperationsClient { + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing event summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String billingAccountId, String billingProfileId, String startDate, String endDate); + + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @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 result of listing event summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String billingAccountId, String billingProfileId, String startDate, String endDate, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ForecastsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ForecastsClient.java new file mode 100644 index 0000000000000..590958ba8d5d1 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ForecastsClient.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.ForecastInner; + +/** An instance of this class provides access to all the operations defined in ForecastsClient. */ +public interface ForecastsClient { + /** + * Lists the forecast charges by subscriptionId. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or + * properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + * 'ne', 'or', or 'not'. + * @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 result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/LotsOperationsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/LotsOperationsClient.java new file mode 100644 index 0000000000000..bb01b16c41436 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/LotsOperationsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.LotSummaryInner; + +/** An instance of this class provides access to all the operations defined in LotsOperationsClient. */ +public interface LotsOperationsClient { + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing lot summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String billingAccountId, String billingProfileId); + + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing lot summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String billingAccountId, String billingProfileId, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/MarketplacesClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/MarketplacesClient.java new file mode 100644 index 0000000000000..56f5b91e7340d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/MarketplacesClient.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.MarketplaceInner; + +/** An instance of this class provides access to all the operations defined in MarketplacesClient. */ +public interface MarketplacesClient { + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc + * time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', + * 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param 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 result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String filter, Integer top, String skiptoken, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/OperationsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/OperationsClient.java new file mode 100644 index 0000000000000..d8528c9abbd37 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available consumption REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing consumption operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available consumption REST API operations. + * + * @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 result of listing consumption operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/PriceSheetsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/PriceSheetsClient.java new file mode 100644 index 0000000000000..840cb18b61d47 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/PriceSheetsClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.PriceSheetResultInner; + +/** An instance of this class provides access to all the operations defined in PriceSheetsClient. */ +public interface PriceSheetsClient { + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @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 price sheet for a scope by subscriptionId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PriceSheetResultInner get(); + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String expand, String skiptoken, Integer top, Context context); + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PriceSheetResultInner getByBillingPeriod(String billingPeriodName); + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByBillingPeriodWithResponse( + String billingPeriodName, String expand, String skiptoken, Integer top, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationRecommendationDetailsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationRecommendationDetailsClient.java new file mode 100644 index 0000000000000..a9742765369c7 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationRecommendationDetailsClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.ReservationRecommendationDetailsModelInner; +import com.azure.resourcemanager.consumption.models.LookBackPeriod; +import com.azure.resourcemanager.consumption.models.Scope; +import com.azure.resourcemanager.consumption.models.Term; + +/** + * An instance of this class provides access to all the operations defined in ReservationRecommendationDetailsClient. + */ +public interface ReservationRecommendationDetailsClient { + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReservationRecommendationDetailsModelInner get( + String billingScope, Scope scope, String region, Term term, LookBackPeriod lookBackPeriod, String product); + + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String billingScope, + Scope scope, + String region, + Term term, + LookBackPeriod lookBackPeriod, + String product, + Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationRecommendationsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationRecommendationsClient.java new file mode 100644 index 0000000000000..c713f5d4d2771 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationRecommendationsClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.ReservationRecommendationInner; + +/** An instance of this class provides access to all the operations defined in ReservationRecommendationsClient. */ +public interface ReservationRecommendationsClient { + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param filter May be used to filter reservationRecommendations by: properties/scope with allowed values + * ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values + * ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', + * 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', + * 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values + * ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String filter, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationTransactionsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationTransactionsClient.java new file mode 100644 index 0000000000000..3d45b967b6e36 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationTransactionsClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.ModernReservationTransactionInner; +import com.azure.resourcemanager.consumption.fluent.models.ReservationTransactionInner; + +/** An instance of this class provides access to all the operations defined in ReservationTransactionsClient. */ +public interface ReservationTransactionsClient { + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String billingAccountId); + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String billingAccountId, String filter, Context context); + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountId, String billingProfileId); + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountId, String billingProfileId, String filter, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationsDetailsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationsDetailsClient.java new file mode 100644 index 0000000000000..2ffbf884bf393 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationsDetailsClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.ReservationDetailInner; + +/** An instance of this class provides access to all the operations defined in ReservationsDetailsClient. */ +public interface ReservationsDetailsClient { + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByReservationOrder(String reservationOrderId, String filter); + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByReservationOrder( + String reservationOrderId, String filter, Context context); + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, String filter); + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, String filter, Context context); + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String scope, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationsSummariesClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationsSummariesClient.java new file mode 100644 index 0000000000000..40be069d1339d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationsSummariesClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.ReservationSummaryInner; +import com.azure.resourcemanager.consumption.models.Datagrain; + +/** An instance of this class provides access to all the operations defined in ReservationsSummariesClient. */ +public interface ReservationsSummariesClient { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByReservationOrder(String reservationOrderId, Datagrain grain); + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByReservationOrder( + String reservationOrderId, Datagrain grain, String filter, Context context); + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, Datagrain grain); + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, Datagrain grain, String filter, Context context); + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Datagrain grain); + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String scope, + Datagrain grain, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/TagsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/TagsClient.java new file mode 100644 index 0000000000000..2266b2caca8cc --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/TagsClient.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.TagsResultInner; + +/** An instance of this class provides access to all the operations defined in TagsClient. */ +public interface TagsClient { + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available tag keys for the defined scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagsResultInner get(String scope); + + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available tag keys for the defined scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/UsageDetailsClient.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/UsageDetailsClient.java new file mode 100644 index 0000000000000..e89c21afee289 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/UsageDetailsClient.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.fluent.models.UsageDetailInner; +import com.azure.resourcemanager.consumption.models.Metrictype; + +/** An instance of this class provides access to all the operations defined in UsageDetailsClient. */ +public interface UsageDetailsClient { + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param expand May be used to expand the properties/additionalInfo or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, + * properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The + * filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter + * accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param metric Allows to select different type of cost/usage records. + * @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 result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String scope, String expand, String filter, String skiptoken, Integer top, Metrictype metric, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/BalanceInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/BalanceInner.java new file mode 100644 index 0000000000000..661b90b6b0623 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/BalanceInner.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.BalancePropertiesAdjustmentDetailsItem; +import com.azure.resourcemanager.consumption.models.BalancePropertiesNewPurchasesDetailsItem; +import com.azure.resourcemanager.consumption.models.BillingFrequency; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** A balance resource. */ +@JsonFlatten +@Fluent +public class BalanceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BalanceInner.class); + + /* + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * The beginning balance for the billing period. + */ + @JsonProperty(value = "properties.beginningBalance", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal beginningBalance; + + /* + * The ending balance for the billing period (for open periods this will be + * updated daily). + */ + @JsonProperty(value = "properties.endingBalance", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal endingBalance; + + /* + * Total new purchase amount. + */ + @JsonProperty(value = "properties.newPurchases", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal newPurchases; + + /* + * Total adjustment amount. + */ + @JsonProperty(value = "properties.adjustments", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal adjustments; + + /* + * Total Commitment usage. + */ + @JsonProperty(value = "properties.utilized", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal utilized; + + /* + * Overage for Azure services. + */ + @JsonProperty(value = "properties.serviceOverage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal serviceOverage; + + /* + * Charges Billed separately. + */ + @JsonProperty(value = "properties.chargesBilledSeparately", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal chargesBilledSeparately; + + /* + * serviceOverage + chargesBilledSeparately. + */ + @JsonProperty(value = "properties.totalOverage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalOverage; + + /* + * Azure service commitment + total Overage. + */ + @JsonProperty(value = "properties.totalUsage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalUsage; + + /* + * Total charges for Azure Marketplace. + */ + @JsonProperty(value = "properties.azureMarketplaceServiceCharges", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal azureMarketplaceServiceCharges; + + /* + * The billing frequency. + */ + @JsonProperty(value = "properties.billingFrequency") + private BillingFrequency billingFrequency; + + /* + * Price is hidden or not. + */ + @JsonProperty(value = "properties.priceHidden", access = JsonProperty.Access.WRITE_ONLY) + private Boolean priceHidden; + + /* + * List of new purchases. + */ + @JsonProperty(value = "properties.newPurchasesDetails", access = JsonProperty.Access.WRITE_ONLY) + private List newPurchasesDetails; + + /* + * List of Adjustments (Promo credit, SIE credit etc.). + */ + @JsonProperty(value = "properties.adjustmentDetails", access = JsonProperty.Access.WRITE_ONLY) + private List adjustmentDetails; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the currency property: The ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the beginningBalance property: The beginning balance for the billing period. + * + * @return the beginningBalance value. + */ + public BigDecimal beginningBalance() { + return this.beginningBalance; + } + + /** + * Get the endingBalance property: The ending balance for the billing period (for open periods this will be updated + * daily). + * + * @return the endingBalance value. + */ + public BigDecimal endingBalance() { + return this.endingBalance; + } + + /** + * Get the newPurchases property: Total new purchase amount. + * + * @return the newPurchases value. + */ + public BigDecimal newPurchases() { + return this.newPurchases; + } + + /** + * Get the adjustments property: Total adjustment amount. + * + * @return the adjustments value. + */ + public BigDecimal adjustments() { + return this.adjustments; + } + + /** + * Get the utilized property: Total Commitment usage. + * + * @return the utilized value. + */ + public BigDecimal utilized() { + return this.utilized; + } + + /** + * Get the serviceOverage property: Overage for Azure services. + * + * @return the serviceOverage value. + */ + public BigDecimal serviceOverage() { + return this.serviceOverage; + } + + /** + * Get the chargesBilledSeparately property: Charges Billed separately. + * + * @return the chargesBilledSeparately value. + */ + public BigDecimal chargesBilledSeparately() { + return this.chargesBilledSeparately; + } + + /** + * Get the totalOverage property: serviceOverage + chargesBilledSeparately. + * + * @return the totalOverage value. + */ + public BigDecimal totalOverage() { + return this.totalOverage; + } + + /** + * Get the totalUsage property: Azure service commitment + total Overage. + * + * @return the totalUsage value. + */ + public BigDecimal totalUsage() { + return this.totalUsage; + } + + /** + * Get the azureMarketplaceServiceCharges property: Total charges for Azure Marketplace. + * + * @return the azureMarketplaceServiceCharges value. + */ + public BigDecimal azureMarketplaceServiceCharges() { + return this.azureMarketplaceServiceCharges; + } + + /** + * Get the billingFrequency property: The billing frequency. + * + * @return the billingFrequency value. + */ + public BillingFrequency billingFrequency() { + return this.billingFrequency; + } + + /** + * Set the billingFrequency property: The billing frequency. + * + * @param billingFrequency the billingFrequency value to set. + * @return the BalanceInner object itself. + */ + public BalanceInner withBillingFrequency(BillingFrequency billingFrequency) { + this.billingFrequency = billingFrequency; + return this; + } + + /** + * Get the priceHidden property: Price is hidden or not. + * + * @return the priceHidden value. + */ + public Boolean priceHidden() { + return this.priceHidden; + } + + /** + * Get the newPurchasesDetails property: List of new purchases. + * + * @return the newPurchasesDetails value. + */ + public List newPurchasesDetails() { + return this.newPurchasesDetails; + } + + /** + * Get the adjustmentDetails property: List of Adjustments (Promo credit, SIE credit etc.). + * + * @return the adjustmentDetails value. + */ + public List adjustmentDetails() { + return this.adjustmentDetails; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (newPurchasesDetails() != null) { + newPurchasesDetails().forEach(e -> e.validate()); + } + if (adjustmentDetails() != null) { + adjustmentDetails().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/BudgetInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/BudgetInner.java new file mode 100644 index 0000000000000..e2827cccd5da7 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/BudgetInner.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.BudgetFilter; +import com.azure.resourcemanager.consumption.models.BudgetTimePeriod; +import com.azure.resourcemanager.consumption.models.CategoryType; +import com.azure.resourcemanager.consumption.models.CurrentSpend; +import com.azure.resourcemanager.consumption.models.Notification; +import com.azure.resourcemanager.consumption.models.TimeGrainType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.Map; + +/** A budget resource. */ +@JsonFlatten +@Fluent +public class BudgetInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BudgetInner.class); + + /* + * The category of the budget, whether the budget tracks cost or usage. + */ + @JsonProperty(value = "properties.category") + private CategoryType category; + + /* + * The total amount of cost to track with the budget + */ + @JsonProperty(value = "properties.amount") + private BigDecimal amount; + + /* + * The time covered by a budget. Tracking of the amount will be reset based + * on the time grain. BillingMonth, BillingQuarter, and BillingAnnual are + * only supported by WD customers + */ + @JsonProperty(value = "properties.timeGrain") + private TimeGrainType timeGrain; + + /* + * Has start and end date of the budget. The start date must be first of + * the month and should be less than the end date. Budget start date must + * be on or after June 1, 2017. Future start date should not be more than + * twelve months. Past start date should be selected within the timegrain + * period. There are no restrictions on the end date. + */ + @JsonProperty(value = "properties.timePeriod") + private BudgetTimePeriod timePeriod; + + /* + * May be used to filter budgets by resource group, resource, or meter. + */ + @JsonProperty(value = "properties.filter") + private BudgetFilter filter; + + /* + * The current amount of cost which is being tracked for a budget. + */ + @JsonProperty(value = "properties.currentSpend", access = JsonProperty.Access.WRITE_ONLY) + private CurrentSpend currentSpend; + + /* + * Dictionary of notifications associated with the budget. Budget can have + * up to five notifications. + */ + @JsonProperty(value = "properties.notifications") + private Map notifications; + + /* + * eTag of the resource. To handle concurrent update scenario, this field + * will be used to determine whether the user is updating the latest + * version or not. + */ + @JsonProperty(value = "eTag") + private String etag; + + /** + * Get the category property: The category of the budget, whether the budget tracks cost or usage. + * + * @return the category value. + */ + public CategoryType category() { + return this.category; + } + + /** + * Set the category property: The category of the budget, whether the budget tracks cost or usage. + * + * @param category the category value to set. + * @return the BudgetInner object itself. + */ + public BudgetInner withCategory(CategoryType category) { + this.category = category; + return this; + } + + /** + * Get the amount property: The total amount of cost to track with the budget. + * + * @return the amount value. + */ + public BigDecimal amount() { + return this.amount; + } + + /** + * Set the amount property: The total amount of cost to track with the budget. + * + * @param amount the amount value to set. + * @return the BudgetInner object itself. + */ + public BudgetInner withAmount(BigDecimal amount) { + this.amount = amount; + return this; + } + + /** + * Get the timeGrain property: The time covered by a budget. Tracking of the amount will be reset based on the time + * grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD customers. + * + * @return the timeGrain value. + */ + public TimeGrainType timeGrain() { + return this.timeGrain; + } + + /** + * Set the timeGrain property: The time covered by a budget. Tracking of the amount will be reset based on the time + * grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD customers. + * + * @param timeGrain the timeGrain value to set. + * @return the BudgetInner object itself. + */ + public BudgetInner withTimeGrain(TimeGrainType timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the timePeriod property: Has start and end date of the budget. The start date must be first of the month and + * should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should + * not be more than twelve months. Past start date should be selected within the timegrain period. There are no + * restrictions on the end date. + * + * @return the timePeriod value. + */ + public BudgetTimePeriod timePeriod() { + return this.timePeriod; + } + + /** + * Set the timePeriod property: Has start and end date of the budget. The start date must be first of the month and + * should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should + * not be more than twelve months. Past start date should be selected within the timegrain period. There are no + * restrictions on the end date. + * + * @param timePeriod the timePeriod value to set. + * @return the BudgetInner object itself. + */ + public BudgetInner withTimePeriod(BudgetTimePeriod timePeriod) { + this.timePeriod = timePeriod; + return this; + } + + /** + * Get the filter property: May be used to filter budgets by resource group, resource, or meter. + * + * @return the filter value. + */ + public BudgetFilter filter() { + return this.filter; + } + + /** + * Set the filter property: May be used to filter budgets by resource group, resource, or meter. + * + * @param filter the filter value to set. + * @return the BudgetInner object itself. + */ + public BudgetInner withFilter(BudgetFilter filter) { + this.filter = filter; + return this; + } + + /** + * Get the currentSpend property: The current amount of cost which is being tracked for a budget. + * + * @return the currentSpend value. + */ + public CurrentSpend currentSpend() { + return this.currentSpend; + } + + /** + * Get the notifications property: Dictionary of notifications associated with the budget. Budget can have up to + * five notifications. + * + * @return the notifications value. + */ + public Map notifications() { + return this.notifications; + } + + /** + * Set the notifications property: Dictionary of notifications associated with the budget. Budget can have up to + * five notifications. + * + * @param notifications the notifications value to set. + * @return the BudgetInner object itself. + */ + public BudgetInner withNotifications(Map notifications) { + this.notifications = notifications; + return this; + } + + /** + * Get the etag property: eTag of the resource. To handle concurrent update scenario, this field will be used to + * determine whether the user is updating the latest version or not. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: eTag of the resource. To handle concurrent update scenario, this field will be used to + * determine whether the user is updating the latest version or not. + * + * @param etag the etag value to set. + * @return the BudgetInner object itself. + */ + public BudgetInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timePeriod() != null) { + timePeriod().validate(); + } + if (filter() != null) { + filter().validate(); + } + if (currentSpend() != null) { + currentSpend().validate(); + } + if (notifications() != null) { + notifications() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ChargesListResultInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ChargesListResultInner.java new file mode 100644 index 0000000000000..4675dd79f2cb1 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ChargesListResultInner.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.ChargeSummary; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing charge summary. */ +@Immutable +public final class ChargesListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ChargesListResultInner.class); + + /* + * The list of charge summary + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of charge summary. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/CreditSummaryInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/CreditSummaryInner.java new file mode 100644 index 0000000000000..e771d8bf1ff96 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/CreditSummaryInner.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.Amount; +import com.azure.resourcemanager.consumption.models.CreditBalanceSummary; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A credit summary resource. */ +@JsonFlatten +@Immutable +public class CreditSummaryInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreditSummaryInner.class); + + /* + * Summary of balances associated with this credit summary. + */ + @JsonProperty(value = "properties.balanceSummary", access = JsonProperty.Access.WRITE_ONLY) + private CreditBalanceSummary balanceSummary; + + /* + * Pending credit adjustments. + */ + @JsonProperty(value = "properties.pendingCreditAdjustments", access = JsonProperty.Access.WRITE_ONLY) + private Amount pendingCreditAdjustments; + + /* + * Expired credit. + */ + @JsonProperty(value = "properties.expiredCredit", access = JsonProperty.Access.WRITE_ONLY) + private Amount expiredCredit; + + /* + * Pending eligible charges. + */ + @JsonProperty(value = "properties.pendingEligibleCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount pendingEligibleCharges; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the balanceSummary property: Summary of balances associated with this credit summary. + * + * @return the balanceSummary value. + */ + public CreditBalanceSummary balanceSummary() { + return this.balanceSummary; + } + + /** + * Get the pendingCreditAdjustments property: Pending credit adjustments. + * + * @return the pendingCreditAdjustments value. + */ + public Amount pendingCreditAdjustments() { + return this.pendingCreditAdjustments; + } + + /** + * Get the expiredCredit property: Expired credit. + * + * @return the expiredCredit value. + */ + public Amount expiredCredit() { + return this.expiredCredit; + } + + /** + * Get the pendingEligibleCharges property: Pending eligible charges. + * + * @return the pendingEligibleCharges value. + */ + public Amount pendingEligibleCharges() { + return this.pendingEligibleCharges; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (balanceSummary() != null) { + balanceSummary().validate(); + } + if (pendingCreditAdjustments() != null) { + pendingCreditAdjustments().validate(); + } + if (expiredCredit() != null) { + expiredCredit().validate(); + } + if (pendingEligibleCharges() != null) { + pendingEligibleCharges().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/EventSummaryInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/EventSummaryInner.java new file mode 100644 index 0000000000000..22e70ac9c3f7d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/EventSummaryInner.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.Amount; +import com.azure.resourcemanager.consumption.models.EventType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An event summary resource. */ +@JsonFlatten +@Fluent +public class EventSummaryInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventSummaryInner.class); + + /* + * Transaction date. + */ + @JsonProperty(value = "properties.transactionDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime transactionDate; + + /* + * Transaction description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * New Credit. + */ + @JsonProperty(value = "properties.newCredit", access = JsonProperty.Access.WRITE_ONLY) + private Amount newCredit; + + /* + * Adjustments amount. + */ + @JsonProperty(value = "properties.adjustments", access = JsonProperty.Access.WRITE_ONLY) + private Amount adjustments; + + /* + * Credit expired. + */ + @JsonProperty(value = "properties.creditExpired", access = JsonProperty.Access.WRITE_ONLY) + private Amount creditExpired; + + /* + * Charges amount. + */ + @JsonProperty(value = "properties.charges", access = JsonProperty.Access.WRITE_ONLY) + private Amount charges; + + /* + * Closed balance. + */ + @JsonProperty(value = "properties.closedBalance", access = JsonProperty.Access.WRITE_ONLY) + private Amount closedBalance; + + /* + * The type of event. + */ + @JsonProperty(value = "properties.eventType") + private EventType eventType; + + /* + * Invoice number. + */ + @JsonProperty(value = "properties.invoiceNumber", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceNumber; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the transactionDate property: Transaction date. + * + * @return the transactionDate value. + */ + public OffsetDateTime transactionDate() { + return this.transactionDate; + } + + /** + * Get the description property: Transaction description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the newCredit property: New Credit. + * + * @return the newCredit value. + */ + public Amount newCredit() { + return this.newCredit; + } + + /** + * Get the adjustments property: Adjustments amount. + * + * @return the adjustments value. + */ + public Amount adjustments() { + return this.adjustments; + } + + /** + * Get the creditExpired property: Credit expired. + * + * @return the creditExpired value. + */ + public Amount creditExpired() { + return this.creditExpired; + } + + /** + * Get the charges property: Charges amount. + * + * @return the charges value. + */ + public Amount charges() { + return this.charges; + } + + /** + * Get the closedBalance property: Closed balance. + * + * @return the closedBalance value. + */ + public Amount closedBalance() { + return this.closedBalance; + } + + /** + * Get the eventType property: The type of event. + * + * @return the eventType value. + */ + public EventType eventType() { + return this.eventType; + } + + /** + * Set the eventType property: The type of event. + * + * @param eventType the eventType value to set. + * @return the EventSummaryInner object itself. + */ + public EventSummaryInner withEventType(EventType eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get the invoiceNumber property: Invoice number. + * + * @return the invoiceNumber value. + */ + public String invoiceNumber() { + return this.invoiceNumber; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (newCredit() != null) { + newCredit().validate(); + } + if (adjustments() != null) { + adjustments().validate(); + } + if (creditExpired() != null) { + creditExpired().validate(); + } + if (charges() != null) { + charges().validate(); + } + if (closedBalance() != null) { + closedBalance().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ForecastInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ForecastInner.java new file mode 100644 index 0000000000000..26fc49d65a55b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ForecastInner.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.ChargeType; +import com.azure.resourcemanager.consumption.models.ForecastPropertiesConfidenceLevelsItem; +import com.azure.resourcemanager.consumption.models.Grain; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** A forecast resource. */ +@JsonFlatten +@Fluent +public class ForecastInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ForecastInner.class); + + /* + * The usage date of the forecast. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private String usageDate; + + /* + * The granularity of forecast. + */ + @JsonProperty(value = "properties.grain") + private Grain grain; + + /* + * The amount of charge + */ + @JsonProperty(value = "properties.charge", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal charge; + + /* + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * The type of the charge. Could be actual or forecast + */ + @JsonProperty(value = "properties.chargeType") + private ChargeType chargeType; + + /* + * The details about the forecast confidence levels. This is populated only + * when chargeType is Forecast. + */ + @JsonProperty(value = "properties.confidenceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List confidenceLevels; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the usageDate property: The usage date of the forecast. + * + * @return the usageDate value. + */ + public String usageDate() { + return this.usageDate; + } + + /** + * Get the grain property: The granularity of forecast. + * + * @return the grain value. + */ + public Grain grain() { + return this.grain; + } + + /** + * Set the grain property: The granularity of forecast. + * + * @param grain the grain value to set. + * @return the ForecastInner object itself. + */ + public ForecastInner withGrain(Grain grain) { + this.grain = grain; + return this; + } + + /** + * Get the charge property: The amount of charge. + * + * @return the charge value. + */ + public BigDecimal charge() { + return this.charge; + } + + /** + * Get the currency property: The ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the chargeType property: The type of the charge. Could be actual or forecast. + * + * @return the chargeType value. + */ + public ChargeType chargeType() { + return this.chargeType; + } + + /** + * Set the chargeType property: The type of the charge. Could be actual or forecast. + * + * @param chargeType the chargeType value to set. + * @return the ForecastInner object itself. + */ + public ForecastInner withChargeType(ChargeType chargeType) { + this.chargeType = chargeType; + return this; + } + + /** + * Get the confidenceLevels property: The details about the forecast confidence levels. This is populated only when + * chargeType is Forecast. + * + * @return the confidenceLevels value. + */ + public List confidenceLevels() { + return this.confidenceLevels; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (confidenceLevels() != null) { + confidenceLevels().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/LotSummaryInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/LotSummaryInner.java new file mode 100644 index 0000000000000..b4ae413ccf68c --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/LotSummaryInner.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.Amount; +import com.azure.resourcemanager.consumption.models.LotSource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A lot summary resource. */ +@JsonFlatten +@Immutable +public class LotSummaryInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LotSummaryInner.class); + + /* + * Original amount. + */ + @JsonProperty(value = "properties.originalAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount originalAmount; + + /* + * Closed balance. + */ + @JsonProperty(value = "properties.closedBalance", access = JsonProperty.Access.WRITE_ONLY) + private Amount closedBalance; + + /* + * Lot source. + */ + @JsonProperty(value = "properties.source", access = JsonProperty.Access.WRITE_ONLY) + private LotSource source; + + /* + * Start date. + */ + @JsonProperty(value = "properties.startDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startDate; + + /* + * Expiration date. + */ + @JsonProperty(value = "properties.expirationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expirationDate; + + /* + * PO number. + */ + @JsonProperty(value = "properties.poNumber", access = JsonProperty.Access.WRITE_ONLY) + private String poNumber; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the originalAmount property: Original amount. + * + * @return the originalAmount value. + */ + public Amount originalAmount() { + return this.originalAmount; + } + + /** + * Get the closedBalance property: Closed balance. + * + * @return the closedBalance value. + */ + public Amount closedBalance() { + return this.closedBalance; + } + + /** + * Get the source property: Lot source. + * + * @return the source value. + */ + public LotSource source() { + return this.source; + } + + /** + * Get the startDate property: Start date. + * + * @return the startDate value. + */ + public OffsetDateTime startDate() { + return this.startDate; + } + + /** + * Get the expirationDate property: Expiration date. + * + * @return the expirationDate value. + */ + public OffsetDateTime expirationDate() { + return this.expirationDate; + } + + /** + * Get the poNumber property: PO number. + * + * @return the poNumber value. + */ + public String poNumber() { + return this.poNumber; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (originalAmount() != null) { + originalAmount().validate(); + } + if (closedBalance() != null) { + closedBalance().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ManagementGroupAggregatedCostResultInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ManagementGroupAggregatedCostResultInner.java new file mode 100644 index 0000000000000..0cce6363e9762 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ManagementGroupAggregatedCostResultInner.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** A management group aggregated cost resource. */ +@JsonFlatten +@Fluent +public class ManagementGroupAggregatedCostResultInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupAggregatedCostResultInner.class); + + /* + * The id of the billing period resource that the aggregated cost belongs + * to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /* + * The start of the date time range covered by aggregated cost. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime usageStart; + + /* + * The end of the date time range covered by the aggregated cost. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime usageEnd; + + /* + * Azure Charges. + */ + @JsonProperty(value = "properties.azureCharges", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal azureCharges; + + /* + * Marketplace Charges. + */ + @JsonProperty(value = "properties.marketplaceCharges", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal marketplaceCharges; + + /* + * Charges Billed Separately. + */ + @JsonProperty(value = "properties.chargesBilledSeparately", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal chargesBilledSeparately; + + /* + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * Children of a management group + */ + @JsonProperty(value = "properties.children") + private List children; + + /* + * List of subscription Guids included in the calculation of aggregated + * cost + */ + @JsonProperty(value = "properties.includedSubscriptions") + private List includedSubscriptions; + + /* + * List of subscription Guids excluded from the calculation of aggregated + * cost + */ + @JsonProperty(value = "properties.excludedSubscriptions") + private List excludedSubscriptions; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the billingPeriodId property: The id of the billing period resource that the aggregated cost belongs to. + * + * @return the billingPeriodId value. + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get the usageStart property: The start of the date time range covered by aggregated cost. + * + * @return the usageStart value. + */ + public OffsetDateTime usageStart() { + return this.usageStart; + } + + /** + * Get the usageEnd property: The end of the date time range covered by the aggregated cost. + * + * @return the usageEnd value. + */ + public OffsetDateTime usageEnd() { + return this.usageEnd; + } + + /** + * Get the azureCharges property: Azure Charges. + * + * @return the azureCharges value. + */ + public BigDecimal azureCharges() { + return this.azureCharges; + } + + /** + * Get the marketplaceCharges property: Marketplace Charges. + * + * @return the marketplaceCharges value. + */ + public BigDecimal marketplaceCharges() { + return this.marketplaceCharges; + } + + /** + * Get the chargesBilledSeparately property: Charges Billed Separately. + * + * @return the chargesBilledSeparately value. + */ + public BigDecimal chargesBilledSeparately() { + return this.chargesBilledSeparately; + } + + /** + * Get the currency property: The ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the children property: Children of a management group. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Set the children property: Children of a management group. + * + * @param children the children value to set. + * @return the ManagementGroupAggregatedCostResultInner object itself. + */ + public ManagementGroupAggregatedCostResultInner withChildren( + List children) { + this.children = children; + return this; + } + + /** + * Get the includedSubscriptions property: List of subscription Guids included in the calculation of aggregated + * cost. + * + * @return the includedSubscriptions value. + */ + public List includedSubscriptions() { + return this.includedSubscriptions; + } + + /** + * Set the includedSubscriptions property: List of subscription Guids included in the calculation of aggregated + * cost. + * + * @param includedSubscriptions the includedSubscriptions value to set. + * @return the ManagementGroupAggregatedCostResultInner object itself. + */ + public ManagementGroupAggregatedCostResultInner withIncludedSubscriptions(List includedSubscriptions) { + this.includedSubscriptions = includedSubscriptions; + return this; + } + + /** + * Get the excludedSubscriptions property: List of subscription Guids excluded from the calculation of aggregated + * cost. + * + * @return the excludedSubscriptions value. + */ + public List excludedSubscriptions() { + return this.excludedSubscriptions; + } + + /** + * Set the excludedSubscriptions property: List of subscription Guids excluded from the calculation of aggregated + * cost. + * + * @param excludedSubscriptions the excludedSubscriptions value to set. + * @return the ManagementGroupAggregatedCostResultInner object itself. + */ + public ManagementGroupAggregatedCostResultInner withExcludedSubscriptions(List excludedSubscriptions) { + this.excludedSubscriptions = excludedSubscriptions; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/MarketplaceInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/MarketplaceInner.java new file mode 100644 index 0000000000000..580216a6e8368 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/MarketplaceInner.java @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** An marketplace resource. */ +@JsonFlatten +@Immutable +public class MarketplaceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplaceInner.class); + + /* + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /* + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime usageStart; + + /* + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime usageEnd; + + /* + * The marketplace resource rate. + */ + @JsonProperty(value = "properties.resourceRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal resourceRate; + + /* + * The type of offer. + */ + @JsonProperty(value = "properties.offerName", access = JsonProperty.Access.WRITE_ONLY) + private String offerName; + + /* + * The name of resource group. + */ + @JsonProperty(value = "properties.resourceGroup", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroup; + + /* + * The order number. + */ + @JsonProperty(value = "properties.orderNumber", access = JsonProperty.Access.WRITE_ONLY) + private String orderNumber; + + /* + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /* + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /* + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * The quantity of usage. + */ + @JsonProperty(value = "properties.consumedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal consumedQuantity; + + /* + * The unit of measure. + */ + @JsonProperty(value = "properties.unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /* + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /* + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /* + * The meter id (GUID). + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /* + * Subscription guid. + */ + @JsonProperty(value = "properties.subscriptionGuid", access = JsonProperty.Access.WRITE_ONLY) + private UUID subscriptionGuid; + + /* + * Subscription name. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /* + * Account name. + */ + @JsonProperty(value = "properties.accountName", access = JsonProperty.Access.WRITE_ONLY) + private String accountName; + + /* + * Department name. + */ + @JsonProperty(value = "properties.departmentName", access = JsonProperty.Access.WRITE_ONLY) + private String departmentName; + + /* + * Consumed service name. + */ + @JsonProperty(value = "properties.consumedService", access = JsonProperty.Access.WRITE_ONLY) + private String consumedService; + + /* + * The cost center of this department if it is a department and a + * costcenter exists + */ + @JsonProperty(value = "properties.costCenter", access = JsonProperty.Access.WRITE_ONLY) + private String costCenter; + + /* + * Additional details of this usage item. By default this is not populated, + * unless it's specified in $expand. + */ + @JsonProperty(value = "properties.additionalProperties", access = JsonProperty.Access.WRITE_ONLY) + private String additionalProperties; + + /* + * The name of publisher. + */ + @JsonProperty(value = "properties.publisherName", access = JsonProperty.Access.WRITE_ONLY) + private String publisherName; + + /* + * The name of plan. + */ + @JsonProperty(value = "properties.planName", access = JsonProperty.Access.WRITE_ONLY) + private String planName; + + /* + * Flag indicating whether this is a recurring charge or not. + */ + @JsonProperty(value = "properties.isRecurringCharge", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isRecurringCharge; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the billingPeriodId property: The id of the billing period resource that the usage belongs to. + * + * @return the billingPeriodId value. + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get the usageStart property: The start of the date time range covered by the usage detail. + * + * @return the usageStart value. + */ + public OffsetDateTime usageStart() { + return this.usageStart; + } + + /** + * Get the usageEnd property: The end of the date time range covered by the usage detail. + * + * @return the usageEnd value. + */ + public OffsetDateTime usageEnd() { + return this.usageEnd; + } + + /** + * Get the resourceRate property: The marketplace resource rate. + * + * @return the resourceRate value. + */ + public BigDecimal resourceRate() { + return this.resourceRate; + } + + /** + * Get the offerName property: The type of offer. + * + * @return the offerName value. + */ + public String offerName() { + return this.offerName; + } + + /** + * Get the resourceGroup property: The name of resource group. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Get the orderNumber property: The order number. + * + * @return the orderNumber value. + */ + public String orderNumber() { + return this.orderNumber; + } + + /** + * Get the instanceName property: The name of the resource instance that the usage is about. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the instanceId property: The uri of the resource instance that the usage is about. + * + * @return the instanceId value. + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get the currency property: The ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the consumedQuantity property: The quantity of usage. + * + * @return the consumedQuantity value. + */ + public BigDecimal consumedQuantity() { + return this.consumedQuantity; + } + + /** + * Get the unitOfMeasure property: The unit of measure. + * + * @return the unitOfMeasure value. + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get the pretaxCost property: The amount of cost before tax. + * + * @return the pretaxCost value. + */ + public BigDecimal pretaxCost() { + return this.pretaxCost; + } + + /** + * Get the isEstimated property: The estimated usage is subject to change. + * + * @return the isEstimated value. + */ + public Boolean isEstimated() { + return this.isEstimated; + } + + /** + * Get the meterId property: The meter id (GUID). + * + * @return the meterId value. + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get the subscriptionGuid property: Subscription guid. + * + * @return the subscriptionGuid value. + */ + public UUID subscriptionGuid() { + return this.subscriptionGuid; + } + + /** + * Get the subscriptionName property: Subscription name. + * + * @return the subscriptionName value. + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Get the accountName property: Account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Get the departmentName property: Department name. + * + * @return the departmentName value. + */ + public String departmentName() { + return this.departmentName; + } + + /** + * Get the consumedService property: Consumed service name. + * + * @return the consumedService value. + */ + public String consumedService() { + return this.consumedService; + } + + /** + * Get the costCenter property: The cost center of this department if it is a department and a costcenter exists. + * + * @return the costCenter value. + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Get the additionalProperties property: Additional details of this usage item. By default this is not populated, + * unless it's specified in $expand. + * + * @return the additionalProperties value. + */ + public String additionalProperties() { + return this.additionalProperties; + } + + /** + * Get the publisherName property: The name of publisher. + * + * @return the publisherName value. + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Get the planName property: The name of plan. + * + * @return the planName value. + */ + public String planName() { + return this.planName; + } + + /** + * Get the isRecurringCharge property: Flag indicating whether this is a recurring charge or not. + * + * @return the isRecurringCharge value. + */ + public Boolean isRecurringCharge() { + return this.isRecurringCharge; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ModernReservationTransactionInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ModernReservationTransactionInner.java new file mode 100644 index 0000000000000..444c92f8195d3 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ModernReservationTransactionInner.java @@ -0,0 +1,339 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.ReservationTransactionResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Modern Reservation transaction resource. */ +@JsonFlatten +@Immutable +public class ModernReservationTransactionInner extends ReservationTransactionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ModernReservationTransactionInner.class); + + /* + * The charge of the transaction. + */ + @JsonProperty(value = "properties.amount", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal amount; + + /* + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.armSkuName", access = JsonProperty.Access.WRITE_ONLY) + private String armSkuName; + + /* + * The billing frequency, which can be either one-time or recurring. + */ + @JsonProperty(value = "properties.billingFrequency", access = JsonProperty.Access.WRITE_ONLY) + private String billingFrequency; + + /* + * Billing profile Id. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * Billing profile name. + */ + @JsonProperty(value = "properties.billingProfileName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileName; + + /* + * The ISO currency in which the transaction is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * The description of the transaction. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The date of the transaction + */ + @JsonProperty(value = "properties.eventDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime eventDate; + + /* + * The type of the transaction (Purchase, Cancel, etc.) + */ + @JsonProperty(value = "properties.eventType", access = JsonProperty.Access.WRITE_ONLY) + private String eventType; + + /* + * Invoice Number + */ + @JsonProperty(value = "properties.invoice", access = JsonProperty.Access.WRITE_ONLY) + private String invoice; + + /* + * Invoice Id as on the invoice where the specific transaction appears. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /* + * Invoice Section Id + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /* + * Invoice Section Name. + */ + @JsonProperty(value = "properties.invoiceSectionName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionName; + + /* + * The subscription guid that makes the transaction. + */ + @JsonProperty(value = "properties.purchasingSubscriptionGuid", access = JsonProperty.Access.WRITE_ONLY) + private UUID purchasingSubscriptionGuid; + + /* + * The subscription name that makes the transaction. + */ + @JsonProperty(value = "properties.purchasingSubscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String purchasingSubscriptionName; + + /* + * The quantity of the transaction. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal quantity; + + /* + * The region of the transaction. + */ + @JsonProperty(value = "properties.region", access = JsonProperty.Access.WRITE_ONLY) + private String region; + + /* + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /* + * The name of the reservation order. + */ + @JsonProperty(value = "properties.reservationOrderName", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderName; + + /* + * This is the term of the transaction. + */ + @JsonProperty(value = "properties.term", access = JsonProperty.Access.WRITE_ONLY) + private String term; + + /** + * Get the amount property: The charge of the transaction. + * + * @return the amount value. + */ + public BigDecimal amount() { + return this.amount; + } + + /** + * Get the armSkuName property: This is the ARM Sku name. It can be used to join with the serviceType field in + * additional info in usage records. + * + * @return the armSkuName value. + */ + public String armSkuName() { + return this.armSkuName; + } + + /** + * Get the billingFrequency property: The billing frequency, which can be either one-time or recurring. + * + * @return the billingFrequency value. + */ + public String billingFrequency() { + return this.billingFrequency; + } + + /** + * Get the billingProfileId property: Billing profile Id. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileName property: Billing profile name. + * + * @return the billingProfileName value. + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Get the currency property: The ISO currency in which the transaction is charged, for example, USD. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the description property: The description of the transaction. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the eventDate property: The date of the transaction. + * + * @return the eventDate value. + */ + public OffsetDateTime eventDate() { + return this.eventDate; + } + + /** + * Get the eventType property: The type of the transaction (Purchase, Cancel, etc.). + * + * @return the eventType value. + */ + public String eventType() { + return this.eventType; + } + + /** + * Get the invoice property: Invoice Number. + * + * @return the invoice value. + */ + public String invoice() { + return this.invoice; + } + + /** + * Get the invoiceId property: Invoice Id as on the invoice where the specific transaction appears. + * + * @return the invoiceId value. + */ + public String invoiceId() { + return this.invoiceId; + } + + /** + * Get the invoiceSectionId property: Invoice Section Id. + * + * @return the invoiceSectionId value. + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the invoiceSectionName property: Invoice Section Name. + * + * @return the invoiceSectionName value. + */ + public String invoiceSectionName() { + return this.invoiceSectionName; + } + + /** + * Get the purchasingSubscriptionGuid property: The subscription guid that makes the transaction. + * + * @return the purchasingSubscriptionGuid value. + */ + public UUID purchasingSubscriptionGuid() { + return this.purchasingSubscriptionGuid; + } + + /** + * Get the purchasingSubscriptionName property: The subscription name that makes the transaction. + * + * @return the purchasingSubscriptionName value. + */ + public String purchasingSubscriptionName() { + return this.purchasingSubscriptionName; + } + + /** + * Get the quantity property: The quantity of the transaction. + * + * @return the quantity value. + */ + public BigDecimal quantity() { + return this.quantity; + } + + /** + * Get the region property: The region of the transaction. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Get the reservationOrderId property: The reservation order ID is the identifier for a reservation purchase. Each + * reservation order ID represents a single purchase transaction. A reservation order contains reservations. The + * reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value. + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservationOrderName property: The name of the reservation order. + * + * @return the reservationOrderName value. + */ + public String reservationOrderName() { + return this.reservationOrderName; + } + + /** + * Get the term property: This is the term of the transaction. + * + * @return the term value. + */ + public String term() { + return this.term; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/OperationInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..4eaf5bcddbd4c --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/OperationInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A Consumption REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/PriceSheetResultInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/PriceSheetResultInner.java new file mode 100644 index 0000000000000..10fe36d8559f3 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/PriceSheetResultInner.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.PriceSheetProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An pricesheet resource. */ +@JsonFlatten +@Immutable +public class PriceSheetResultInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PriceSheetResultInner.class); + + /* + * Price sheet + */ + @JsonProperty(value = "properties.pricesheets", access = JsonProperty.Access.WRITE_ONLY) + private List pricesheets; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "properties.nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the pricesheets property: Price sheet. + * + * @return the pricesheets value. + */ + public List pricesheets() { + return this.pricesheets; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (pricesheets() != null) { + pricesheets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationDetailInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationDetailInner.java new file mode 100644 index 0000000000000..f69c8778a6736 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationDetailInner.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Map; + +/** reservation detail resource. */ +@JsonFlatten +@Immutable +public class ReservationDetailInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationDetailInner.class); + + /* + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /* + * The instance Flexibility Ratio. + */ + @JsonProperty(value = "properties.instanceFlexibilityRatio", access = JsonProperty.Access.WRITE_ONLY) + private String instanceFlexibilityRatio; + + /* + * The instance Flexibility Group. + */ + @JsonProperty(value = "properties.instanceFlexibilityGroup", access = JsonProperty.Access.WRITE_ONLY) + private String instanceFlexibilityGroup; + + /* + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /* + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /* + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /* + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime usageDate; + + /* + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /* + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /* + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /* + * The reservation kind. + */ + @JsonProperty(value = "properties.kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservationOrderId property: The reservation order ID is the identifier for a reservation purchase. Each + * reservation order ID represents a single purchase transaction. A reservation order contains reservations. The + * reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value. + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the instanceFlexibilityRatio property: The instance Flexibility Ratio. + * + * @return the instanceFlexibilityRatio value. + */ + public String instanceFlexibilityRatio() { + return this.instanceFlexibilityRatio; + } + + /** + * Get the instanceFlexibilityGroup property: The instance Flexibility Group. + * + * @return the instanceFlexibilityGroup value. + */ + public String instanceFlexibilityGroup() { + return this.instanceFlexibilityGroup; + } + + /** + * Get the reservationId property: The reservation ID is the identifier of a reservation within a reservation order. + * Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to + * which the reservation benefit can be applied to. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get the skuName property: This is the ARM Sku name. It can be used to join with the serviceType field in + * additional info in usage records. + * + * @return the skuName value. + */ + public String skuName() { + return this.skuName; + } + + /** + * Get the reservedHours property: This is the total hours reserved for the day. E.g. if reservation for 1 instance + * was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value. + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the usageDate property: The date on which consumption occurred. + * + * @return the usageDate value. + */ + public OffsetDateTime usageDate() { + return this.usageDate; + } + + /** + * Get the usedHours property: This is the total hours used by the instance. + * + * @return the usedHours value. + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get the instanceId property: This identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value. + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get the totalReservedQuantity property: This is the total count of instances that are reserved for the + * reservationId. + * + * @return the totalReservedQuantity value. + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get the kind property: The reservation kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationRecommendationDetailsModelInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationRecommendationDetailsModelInner.java new file mode 100644 index 0000000000000..87c9e148f69de --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationRecommendationDetailsModelInner.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetailsResourceProperties; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetailsSavingsProperties; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetailsUsageProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Reservation recommendation details. */ +@JsonFlatten +@Fluent +public class ReservationRecommendationDetailsModelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationRecommendationDetailsModelInner.class); + + /* + * Resource Location. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Resource sku + */ + @JsonProperty(value = "sku") + private String sku; + + /* + * An ISO 4217 currency code identifier for the costs and savings + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * Resource specific properties. + */ + @JsonProperty(value = "properties.resource", access = JsonProperty.Access.WRITE_ONLY) + private ReservationRecommendationDetailsResourceProperties resource; + + /* + * Resource Group. + */ + @JsonProperty(value = "properties.resourceGroup", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroup; + + /* + * Savings information for the recommendation. + */ + @JsonProperty(value = "properties.savings", access = JsonProperty.Access.WRITE_ONLY) + private ReservationRecommendationDetailsSavingsProperties savings; + + /* + * Scope of the reservation, ex: Single or Shared. + */ + @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /* + * Historical usage details used to calculate the estimated savings. + */ + @JsonProperty(value = "properties.usage", access = JsonProperty.Access.WRITE_ONLY) + private ReservationRecommendationDetailsUsageProperties usage; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the location property: Resource Location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Resource Location. + * + * @param location the location value to set. + * @return the ReservationRecommendationDetailsModelInner object itself. + */ + public ReservationRecommendationDetailsModelInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the sku property: Resource sku. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: Resource sku. + * + * @param sku the sku value to set. + * @return the ReservationRecommendationDetailsModelInner object itself. + */ + public ReservationRecommendationDetailsModelInner withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the currency property: An ISO 4217 currency code identifier for the costs and savings. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the resource property: Resource specific properties. + * + * @return the resource value. + */ + public ReservationRecommendationDetailsResourceProperties resource() { + return this.resource; + } + + /** + * Get the resourceGroup property: Resource Group. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Get the savings property: Savings information for the recommendation. + * + * @return the savings value. + */ + public ReservationRecommendationDetailsSavingsProperties savings() { + return this.savings; + } + + /** + * Get the scope property: Scope of the reservation, ex: Single or Shared. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Get the usage property: Historical usage details used to calculate the estimated savings. + * + * @return the usage value. + */ + public ReservationRecommendationDetailsUsageProperties usage() { + return this.usage; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (savings() != null) { + savings().validate(); + } + if (usage() != null) { + usage().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationRecommendationInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationRecommendationInner.java new file mode 100644 index 0000000000000..c98b0d0756bb6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationRecommendationInner.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.LegacyReservationRecommendation; +import com.azure.resourcemanager.consumption.models.ModernReservationRecommendation; +import com.azure.resourcemanager.consumption.models.ResourceAttributes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +/** A reservation recommendation resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = ReservationRecommendationInner.class) +@JsonTypeName("ReservationRecommendation") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "legacy", value = LegacyReservationRecommendation.class), + @JsonSubTypes.Type(name = "modern", value = ModernReservationRecommendation.class) +}) +@Immutable +public class ReservationRecommendationInner extends ResourceAttributes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationRecommendationInner.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationSummaryInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationSummaryInner.java new file mode 100644 index 0000000000000..12ca3ae224553 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationSummaryInner.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Map; + +/** reservation summary resource. */ +@JsonFlatten +@Immutable +public class ReservationSummaryInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationSummaryInner.class); + + /* + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /* + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /* + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /* + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /* + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime usageDate; + + /* + * Total used hours by the reservation + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /* + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /* + * This is average utilization for the entire time range. (day or month + * depending on the grain) + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /* + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /* + * The reservation kind. + */ + @JsonProperty(value = "properties.kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * This is the purchased quantity for the reservationId. + */ + @JsonProperty(value = "properties.purchasedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal purchasedQuantity; + + /* + * This is the remaining quantity for the reservationId. + */ + @JsonProperty(value = "properties.remainingQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal remainingQuantity; + + /* + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /* + * This is the used quantity for the reservationId. + */ + @JsonProperty(value = "properties.usedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedQuantity; + + /* + * This is the utilized percentage for the reservation Id. + */ + @JsonProperty(value = "properties.utilizedPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal utilizedPercentage; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservationOrderId property: The reservation order ID is the identifier for a reservation purchase. Each + * reservation order ID represents a single purchase transaction. A reservation order contains reservations. The + * reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value. + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservationId property: The reservation ID is the identifier of a reservation within a reservation order. + * Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to + * which the reservation benefit can be applied to. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get the skuName property: This is the ARM Sku name. It can be used to join with the serviceType field in + * additional info in usage records. + * + * @return the skuName value. + */ + public String skuName() { + return this.skuName; + } + + /** + * Get the reservedHours property: This is the total hours reserved. E.g. if reservation for 1 instance was made on + * 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value. + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the usageDate property: Data corresponding to the utilization record. If the grain of data is monthly, it + * will be first day of month. + * + * @return the usageDate value. + */ + public OffsetDateTime usageDate() { + return this.usageDate; + } + + /** + * Get the usedHours property: Total used hours by the reservation. + * + * @return the usedHours value. + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get the minUtilizationPercentage property: This is the minimum hourly utilization in the usage time (day or + * month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this + * field will return 10% for that day. + * + * @return the minUtilizationPercentage value. + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get the avgUtilizationPercentage property: This is average utilization for the entire time range. (day or month + * depending on the grain). + * + * @return the avgUtilizationPercentage value. + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get the maxUtilizationPercentage property: This is the maximum hourly utilization in the usage time (day or + * month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this + * field will return 100% for that day. + * + * @return the maxUtilizationPercentage value. + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get the kind property: The reservation kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the purchasedQuantity property: This is the purchased quantity for the reservationId. + * + * @return the purchasedQuantity value. + */ + public BigDecimal purchasedQuantity() { + return this.purchasedQuantity; + } + + /** + * Get the remainingQuantity property: This is the remaining quantity for the reservationId. + * + * @return the remainingQuantity value. + */ + public BigDecimal remainingQuantity() { + return this.remainingQuantity; + } + + /** + * Get the totalReservedQuantity property: This is the total count of instances that are reserved for the + * reservationId. + * + * @return the totalReservedQuantity value. + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get the usedQuantity property: This is the used quantity for the reservationId. + * + * @return the usedQuantity value. + */ + public BigDecimal usedQuantity() { + return this.usedQuantity; + } + + /** + * Get the utilizedPercentage property: This is the utilized percentage for the reservation Id. + * + * @return the utilizedPercentage value. + */ + public BigDecimal utilizedPercentage() { + return this.utilizedPercentage; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationTransactionInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationTransactionInner.java new file mode 100644 index 0000000000000..c941d11d67f4b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/ReservationTransactionInner.java @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.ReservationTransactionResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Reservation transaction resource. */ +@JsonFlatten +@Immutable +public class ReservationTransactionInner extends ReservationTransactionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationTransactionInner.class); + + /* + * The date of the transaction + */ + @JsonProperty(value = "properties.eventDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime eventDate; + + /* + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /* + * The description of the transaction. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The type of the transaction (Purchase, Cancel, etc.) + */ + @JsonProperty(value = "properties.eventType", access = JsonProperty.Access.WRITE_ONLY) + private String eventType; + + /* + * The quantity of the transaction. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal quantity; + + /* + * The charge of the transaction. + */ + @JsonProperty(value = "properties.amount", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal amount; + + /* + * The ISO currency in which the transaction is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * The name of the reservation order. + */ + @JsonProperty(value = "properties.reservationOrderName", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderName; + + /* + * The purchasing enrollment. + */ + @JsonProperty(value = "properties.purchasingEnrollment", access = JsonProperty.Access.WRITE_ONLY) + private String purchasingEnrollment; + + /* + * The subscription guid that makes the transaction. + */ + @JsonProperty(value = "properties.purchasingSubscriptionGuid", access = JsonProperty.Access.WRITE_ONLY) + private UUID purchasingSubscriptionGuid; + + /* + * The subscription name that makes the transaction. + */ + @JsonProperty(value = "properties.purchasingSubscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String purchasingSubscriptionName; + + /* + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.armSkuName", access = JsonProperty.Access.WRITE_ONLY) + private String armSkuName; + + /* + * This is the term of the transaction. + */ + @JsonProperty(value = "properties.term", access = JsonProperty.Access.WRITE_ONLY) + private String term; + + /* + * The region of the transaction. + */ + @JsonProperty(value = "properties.region", access = JsonProperty.Access.WRITE_ONLY) + private String region; + + /* + * The name of the account that makes the transaction. + */ + @JsonProperty(value = "properties.accountName", access = JsonProperty.Access.WRITE_ONLY) + private String accountName; + + /* + * The email of the account owner that makes the transaction. + */ + @JsonProperty(value = "properties.accountOwnerEmail", access = JsonProperty.Access.WRITE_ONLY) + private String accountOwnerEmail; + + /* + * The department name. + */ + @JsonProperty(value = "properties.departmentName", access = JsonProperty.Access.WRITE_ONLY) + private String departmentName; + + /* + * The cost center of this department if it is a department and a cost + * center is provided. + */ + @JsonProperty(value = "properties.costCenter", access = JsonProperty.Access.WRITE_ONLY) + private String costCenter; + + /* + * The current enrollment. + */ + @JsonProperty(value = "properties.currentEnrollment", access = JsonProperty.Access.WRITE_ONLY) + private String currentEnrollment; + + /* + * The billing frequency, which can be either one-time or recurring. + */ + @JsonProperty(value = "properties.billingFrequency", access = JsonProperty.Access.WRITE_ONLY) + private String billingFrequency; + + /** + * Get the eventDate property: The date of the transaction. + * + * @return the eventDate value. + */ + public OffsetDateTime eventDate() { + return this.eventDate; + } + + /** + * Get the reservationOrderId property: The reservation order ID is the identifier for a reservation purchase. Each + * reservation order ID represents a single purchase transaction. A reservation order contains reservations. The + * reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value. + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the description property: The description of the transaction. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the eventType property: The type of the transaction (Purchase, Cancel, etc.). + * + * @return the eventType value. + */ + public String eventType() { + return this.eventType; + } + + /** + * Get the quantity property: The quantity of the transaction. + * + * @return the quantity value. + */ + public BigDecimal quantity() { + return this.quantity; + } + + /** + * Get the amount property: The charge of the transaction. + * + * @return the amount value. + */ + public BigDecimal amount() { + return this.amount; + } + + /** + * Get the currency property: The ISO currency in which the transaction is charged, for example, USD. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the reservationOrderName property: The name of the reservation order. + * + * @return the reservationOrderName value. + */ + public String reservationOrderName() { + return this.reservationOrderName; + } + + /** + * Get the purchasingEnrollment property: The purchasing enrollment. + * + * @return the purchasingEnrollment value. + */ + public String purchasingEnrollment() { + return this.purchasingEnrollment; + } + + /** + * Get the purchasingSubscriptionGuid property: The subscription guid that makes the transaction. + * + * @return the purchasingSubscriptionGuid value. + */ + public UUID purchasingSubscriptionGuid() { + return this.purchasingSubscriptionGuid; + } + + /** + * Get the purchasingSubscriptionName property: The subscription name that makes the transaction. + * + * @return the purchasingSubscriptionName value. + */ + public String purchasingSubscriptionName() { + return this.purchasingSubscriptionName; + } + + /** + * Get the armSkuName property: This is the ARM Sku name. It can be used to join with the serviceType field in + * additional info in usage records. + * + * @return the armSkuName value. + */ + public String armSkuName() { + return this.armSkuName; + } + + /** + * Get the term property: This is the term of the transaction. + * + * @return the term value. + */ + public String term() { + return this.term; + } + + /** + * Get the region property: The region of the transaction. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Get the accountName property: The name of the account that makes the transaction. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Get the accountOwnerEmail property: The email of the account owner that makes the transaction. + * + * @return the accountOwnerEmail value. + */ + public String accountOwnerEmail() { + return this.accountOwnerEmail; + } + + /** + * Get the departmentName property: The department name. + * + * @return the departmentName value. + */ + public String departmentName() { + return this.departmentName; + } + + /** + * Get the costCenter property: The cost center of this department if it is a department and a cost center is + * provided. + * + * @return the costCenter value. + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Get the currentEnrollment property: The current enrollment. + * + * @return the currentEnrollment value. + */ + public String currentEnrollment() { + return this.currentEnrollment; + } + + /** + * Get the billingFrequency property: The billing frequency, which can be either one-time or recurring. + * + * @return the billingFrequency value. + */ + public String billingFrequency() { + return this.billingFrequency; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/TagsResultInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/TagsResultInner.java new file mode 100644 index 0000000000000..13ebceb68bee1 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/TagsResultInner.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.Tag; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A resource listing all tags. */ +@JsonFlatten +@Fluent +public class TagsResultInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsResultInner.class); + + /* + * A list of Tag. + */ + @JsonProperty(value = "properties.tags") + private List tags; + + /* + * eTag of the resource. To handle concurrent update scenario, this field + * will be used to determine whether the user is updating the latest + * version or not. + */ + @JsonProperty(value = "eTag") + private String etag; + + /** + * Get the tags property: A list of Tag. + * + * @return the tags value. + */ + public List tags() { + return this.tags; + } + + /** + * Set the tags property: A list of Tag. + * + * @param tags the tags value to set. + * @return the TagsResultInner object itself. + */ + public TagsResultInner withTags(List tags) { + this.tags = tags; + return this; + } + + /** + * Get the etag property: eTag of the resource. To handle concurrent update scenario, this field will be used to + * determine whether the user is updating the latest version or not. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: eTag of the resource. To handle concurrent update scenario, this field will be used to + * determine whether the user is updating the latest version or not. + * + * @param etag the etag value to set. + * @return the TagsResultInner object itself. + */ + public TagsResultInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tags() != null) { + tags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/UsageDetailInner.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/UsageDetailInner.java new file mode 100644 index 0000000000000..7b3a77f5f491b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/UsageDetailInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.models.LegacyUsageDetail; +import com.azure.resourcemanager.consumption.models.ModernUsageDetail; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +/** An usage detail resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = UsageDetailInner.class) +@JsonTypeName("UsageDetail") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "legacy", value = LegacyUsageDetail.class), + @JsonSubTypes.Type(name = "modern", value = ModernUsageDetail.class) +}) +@Immutable +public class UsageDetailInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageDetailInner.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/package-info.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/package-info.java new file mode 100644 index 0000000000000..7598912d3a16b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 ConsumptionManagementClient. Consumption management client provides + * access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.azure.resourcemanager.consumption.fluent.models; diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/package-info.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/package-info.java new file mode 100644 index 0000000000000..9cd646224d1dc --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 ConsumptionManagementClient. Consumption management client provides access + * to consumption resources for Azure Enterprise Subscriptions. + */ +package com.azure.resourcemanager.consumption.fluent; diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/AggregatedCostsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/AggregatedCostsClientImpl.java new file mode 100644 index 0000000000000..de0c9cf9c220e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/AggregatedCostsClientImpl.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.AggregatedCostsClient; +import com.azure.resourcemanager.consumption.fluent.models.ManagementGroupAggregatedCostResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AggregatedCostsClient. */ +public final class AggregatedCostsClientImpl implements AggregatedCostsClient { + private final ClientLogger logger = new ClientLogger(AggregatedCostsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AggregatedCostsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of AggregatedCostsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AggregatedCostsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(AggregatedCostsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientAggregatedCosts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface AggregatedCostsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption" + + "/aggregatedcost") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing" + + "/billingPeriods/{billingPeriodName}/Microsoft.Consumption/aggregatedcost") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getForBillingPeriodByManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("billingPeriodName") String billingPeriodName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param filter May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc + * time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', + * or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByManagementGroupWithResponseAsync( + String managementGroupId, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByManagementGroup( + this.client.getEndpoint(), + managementGroupId, + this.client.getApiVersion(), + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param filter May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc + * time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', + * or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByManagementGroupWithResponseAsync( + String managementGroupId, 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 (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByManagementGroup( + this.client.getEndpoint(), managementGroupId, this.client.getApiVersion(), filter, accept, context); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param filter May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc + * time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', + * or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByManagementGroupAsync( + String managementGroupId, String filter) { + return getByManagementGroupWithResponseAsync(managementGroupId, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByManagementGroupAsync(String managementGroupId) { + final String filter = null; + return getByManagementGroupWithResponseAsync(managementGroupId, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupAggregatedCostResultInner getByManagementGroup(String managementGroupId) { + final String filter = null; + return getByManagementGroupAsync(managementGroupId, filter).block(); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param filter May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc + * time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', + * or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByManagementGroupWithResponse( + String managementGroupId, String filter, Context context) { + return getByManagementGroupWithResponseAsync(managementGroupId, filter, context).block(); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getForBillingPeriodByManagementGroupWithResponseAsync(String managementGroupId, String billingPeriodName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (billingPeriodName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getForBillingPeriodByManagementGroup( + this.client.getEndpoint(), + managementGroupId, + billingPeriodName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getForBillingPeriodByManagementGroupWithResponseAsync( + String managementGroupId, String billingPeriodName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (billingPeriodName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getForBillingPeriodByManagementGroup( + this.client.getEndpoint(), + managementGroupId, + billingPeriodName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getForBillingPeriodByManagementGroupAsync( + String managementGroupId, String billingPeriodName) { + return getForBillingPeriodByManagementGroupWithResponseAsync(managementGroupId, billingPeriodName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupAggregatedCostResultInner getForBillingPeriodByManagementGroup( + String managementGroupId, String billingPeriodName) { + return getForBillingPeriodByManagementGroupAsync(managementGroupId, billingPeriodName).block(); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getForBillingPeriodByManagementGroupWithResponse( + String managementGroupId, String billingPeriodName, Context context) { + return getForBillingPeriodByManagementGroupWithResponseAsync(managementGroupId, billingPeriodName, context) + .block(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/AggregatedCostsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/AggregatedCostsImpl.java new file mode 100644 index 0000000000000..51661176cb4a7 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/AggregatedCostsImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.AggregatedCostsClient; +import com.azure.resourcemanager.consumption.fluent.models.ManagementGroupAggregatedCostResultInner; +import com.azure.resourcemanager.consumption.models.AggregatedCosts; +import com.azure.resourcemanager.consumption.models.ManagementGroupAggregatedCostResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AggregatedCostsImpl implements AggregatedCosts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AggregatedCostsImpl.class); + + private final AggregatedCostsClient innerClient; + + private final ConsumptionManager serviceManager; + + public AggregatedCostsImpl(AggregatedCostsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagementGroupAggregatedCostResult getByManagementGroup(String managementGroupId) { + ManagementGroupAggregatedCostResultInner inner = this.serviceClient().getByManagementGroup(managementGroupId); + if (inner != null) { + return new ManagementGroupAggregatedCostResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByManagementGroupWithResponse( + String managementGroupId, String filter, Context context) { + Response inner = + this.serviceClient().getByManagementGroupWithResponse(managementGroupId, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagementGroupAggregatedCostResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagementGroupAggregatedCostResult getForBillingPeriodByManagementGroup( + String managementGroupId, String billingPeriodName) { + ManagementGroupAggregatedCostResultInner inner = + this.serviceClient().getForBillingPeriodByManagementGroup(managementGroupId, billingPeriodName); + if (inner != null) { + return new ManagementGroupAggregatedCostResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getForBillingPeriodByManagementGroupWithResponse( + String managementGroupId, String billingPeriodName, Context context) { + Response inner = + this + .serviceClient() + .getForBillingPeriodByManagementGroupWithResponse(managementGroupId, billingPeriodName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagementGroupAggregatedCostResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private AggregatedCostsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalanceImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalanceImpl.java new file mode 100644 index 0000000000000..6f742c2e00239 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalanceImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.BalanceInner; +import com.azure.resourcemanager.consumption.models.Balance; +import com.azure.resourcemanager.consumption.models.BalancePropertiesAdjustmentDetailsItem; +import com.azure.resourcemanager.consumption.models.BalancePropertiesNewPurchasesDetailsItem; +import com.azure.resourcemanager.consumption.models.BillingFrequency; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class BalanceImpl implements Balance { + private BalanceInner innerObject; + + private final ConsumptionManager serviceManager; + + BalanceImpl(BalanceInner innerObject, ConsumptionManager 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 String currency() { + return this.innerModel().currency(); + } + + public BigDecimal beginningBalance() { + return this.innerModel().beginningBalance(); + } + + public BigDecimal endingBalance() { + return this.innerModel().endingBalance(); + } + + public BigDecimal newPurchases() { + return this.innerModel().newPurchases(); + } + + public BigDecimal adjustments() { + return this.innerModel().adjustments(); + } + + public BigDecimal utilized() { + return this.innerModel().utilized(); + } + + public BigDecimal serviceOverage() { + return this.innerModel().serviceOverage(); + } + + public BigDecimal chargesBilledSeparately() { + return this.innerModel().chargesBilledSeparately(); + } + + public BigDecimal totalOverage() { + return this.innerModel().totalOverage(); + } + + public BigDecimal totalUsage() { + return this.innerModel().totalUsage(); + } + + public BigDecimal azureMarketplaceServiceCharges() { + return this.innerModel().azureMarketplaceServiceCharges(); + } + + public BillingFrequency billingFrequency() { + return this.innerModel().billingFrequency(); + } + + public Boolean priceHidden() { + return this.innerModel().priceHidden(); + } + + public List newPurchasesDetails() { + List inner = this.innerModel().newPurchasesDetails(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List adjustmentDetails() { + List inner = this.innerModel().adjustmentDetails(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public BalanceInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalancesClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalancesClientImpl.java new file mode 100644 index 0000000000000..e000ed3fa46a9 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalancesClientImpl.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.BalancesClient; +import com.azure.resourcemanager.consumption.fluent.models.BalanceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BalancesClient. */ +public final class BalancesClientImpl implements BalancesClient { + private final ClientLogger logger = new ClientLogger(BalancesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BalancesService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of BalancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BalancesClientImpl(ConsumptionManagementClientImpl client) { + this.service = RestProxy.create(BalancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientBalances to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface BalancesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountId") String billingAccountId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods" + + "/{billingPeriodName}/providers/Microsoft.Consumption/balances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getForBillingPeriodByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountId") String billingAccountId, + @PathParam("billingPeriodName") String billingPeriodName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingAccountWithResponseAsync(String billingAccountId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByBillingAccount( + this.client.getEndpoint(), this.client.getApiVersion(), billingAccountId, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingAccountWithResponseAsync( + String billingAccountId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByBillingAccount( + this.client.getEndpoint(), this.client.getApiVersion(), billingAccountId, accept, context); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByBillingAccountAsync(String billingAccountId) { + return getByBillingAccountWithResponseAsync(billingAccountId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BalanceInner getByBillingAccount(String billingAccountId) { + return getByBillingAccountAsync(billingAccountId).block(); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByBillingAccountWithResponse(String billingAccountId, Context context) { + return getByBillingAccountWithResponseAsync(billingAccountId, context).block(); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getForBillingPeriodByBillingAccountWithResponseAsync( + String billingAccountId, String billingPeriodName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingPeriodName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getForBillingPeriodByBillingAccount( + this.client.getEndpoint(), + this.client.getApiVersion(), + billingAccountId, + billingPeriodName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getForBillingPeriodByBillingAccountWithResponseAsync( + String billingAccountId, String billingPeriodName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingPeriodName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getForBillingPeriodByBillingAccount( + this.client.getEndpoint(), + this.client.getApiVersion(), + billingAccountId, + billingPeriodName, + accept, + context); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getForBillingPeriodByBillingAccountAsync( + String billingAccountId, String billingPeriodName) { + return getForBillingPeriodByBillingAccountWithResponseAsync(billingAccountId, billingPeriodName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BalanceInner getForBillingPeriodByBillingAccount(String billingAccountId, String billingPeriodName) { + return getForBillingPeriodByBillingAccountAsync(billingAccountId, billingPeriodName).block(); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getForBillingPeriodByBillingAccountWithResponse( + String billingAccountId, String billingPeriodName, Context context) { + return getForBillingPeriodByBillingAccountWithResponseAsync(billingAccountId, billingPeriodName, context) + .block(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalancesImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalancesImpl.java new file mode 100644 index 0000000000000..a2178bf24a032 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalancesImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.BalancesClient; +import com.azure.resourcemanager.consumption.fluent.models.BalanceInner; +import com.azure.resourcemanager.consumption.models.Balance; +import com.azure.resourcemanager.consumption.models.Balances; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BalancesImpl implements Balances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BalancesImpl.class); + + private final BalancesClient innerClient; + + private final ConsumptionManager serviceManager; + + public BalancesImpl(BalancesClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Balance getByBillingAccount(String billingAccountId) { + BalanceInner inner = this.serviceClient().getByBillingAccount(billingAccountId); + if (inner != null) { + return new BalanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByBillingAccountWithResponse(String billingAccountId, Context context) { + Response inner = this.serviceClient().getByBillingAccountWithResponse(billingAccountId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BalanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Balance getForBillingPeriodByBillingAccount(String billingAccountId, String billingPeriodName) { + BalanceInner inner = + this.serviceClient().getForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName); + if (inner != null) { + return new BalanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getForBillingPeriodByBillingAccountWithResponse( + String billingAccountId, String billingPeriodName, Context context) { + Response inner = + this + .serviceClient() + .getForBillingPeriodByBillingAccountWithResponse(billingAccountId, billingPeriodName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BalanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private BalancesClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetImpl.java new file mode 100644 index 0000000000000..87e725348b76c --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.BudgetInner; +import com.azure.resourcemanager.consumption.models.Budget; +import com.azure.resourcemanager.consumption.models.BudgetFilter; +import com.azure.resourcemanager.consumption.models.BudgetTimePeriod; +import com.azure.resourcemanager.consumption.models.CategoryType; +import com.azure.resourcemanager.consumption.models.CurrentSpend; +import com.azure.resourcemanager.consumption.models.Notification; +import com.azure.resourcemanager.consumption.models.TimeGrainType; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.Map; + +public final class BudgetImpl implements Budget, Budget.Definition, Budget.Update { + private BudgetInner innerObject; + + private final ConsumptionManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public CategoryType category() { + return this.innerModel().category(); + } + + public BigDecimal amount() { + return this.innerModel().amount(); + } + + public TimeGrainType timeGrain() { + return this.innerModel().timeGrain(); + } + + public BudgetTimePeriod timePeriod() { + return this.innerModel().timePeriod(); + } + + public BudgetFilter filter() { + return this.innerModel().filter(); + } + + public CurrentSpend currentSpend() { + return this.innerModel().currentSpend(); + } + + public Map notifications() { + Map inner = this.innerModel().notifications(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public BudgetInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } + + private String scope; + + private String budgetName; + + public BudgetImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public Budget create() { + this.innerObject = + serviceManager + .serviceClient() + .getBudgets() + .createOrUpdateWithResponse(scope, budgetName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Budget create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBudgets() + .createOrUpdateWithResponse(scope, budgetName, this.innerModel(), context) + .getValue(); + return this; + } + + BudgetImpl(String name, ConsumptionManager serviceManager) { + this.innerObject = new BudgetInner(); + this.serviceManager = serviceManager; + this.budgetName = name; + } + + public BudgetImpl update() { + return this; + } + + public Budget apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBudgets() + .createOrUpdateWithResponse(scope, budgetName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Budget apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBudgets() + .createOrUpdateWithResponse(scope, budgetName, this.innerModel(), context) + .getValue(); + return this; + } + + BudgetImpl(BudgetInner innerObject, ConsumptionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = + Utils + .getValueFromIdByParameterName( + innerObject.id(), "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "scope"); + this.budgetName = + Utils + .getValueFromIdByParameterName( + innerObject.id(), "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "budgetName"); + } + + public Budget refresh() { + this.innerObject = + serviceManager.serviceClient().getBudgets().getWithResponse(scope, budgetName, Context.NONE).getValue(); + return this; + } + + public Budget refresh(Context context) { + this.innerObject = + serviceManager.serviceClient().getBudgets().getWithResponse(scope, budgetName, context).getValue(); + return this; + } + + public BudgetImpl withCategory(CategoryType category) { + this.innerModel().withCategory(category); + return this; + } + + public BudgetImpl withAmount(BigDecimal amount) { + this.innerModel().withAmount(amount); + return this; + } + + public BudgetImpl withTimeGrain(TimeGrainType timeGrain) { + this.innerModel().withTimeGrain(timeGrain); + return this; + } + + public BudgetImpl withTimePeriod(BudgetTimePeriod timePeriod) { + this.innerModel().withTimePeriod(timePeriod); + return this; + } + + public BudgetImpl withFilter(BudgetFilter filter) { + this.innerModel().withFilter(filter); + return this; + } + + public BudgetImpl withNotifications(Map notifications) { + this.innerModel().withNotifications(notifications); + return this; + } + + public BudgetImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetsClientImpl.java new file mode 100644 index 0000000000000..d0484e92e805f --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetsClientImpl.java @@ -0,0 +1,937 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +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.Put; +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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.BudgetsClient; +import com.azure.resourcemanager.consumption.fluent.models.BudgetInner; +import com.azure.resourcemanager.consumption.models.BudgetsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BudgetsClient. */ +public final class BudgetsClientImpl implements BudgetsClient { + private final ClientLogger logger = new ClientLogger(BudgetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BudgetsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of BudgetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BudgetsClientImpl(ConsumptionManagementClientImpl client) { + this.service = RestProxy.create(BudgetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientBudgets to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface BudgetsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/budgets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @PathParam("budgetName") String budgetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @PathParam("budgetName") String budgetName, + @BodyParam("application/json") BudgetInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @PathParam("budgetName") String budgetName, + @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); + } + + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @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 result of listing budgets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @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 result of listing budgets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @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 result of listing budgets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @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 result of listing budgets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @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 result of listing budgets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @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 result of listing budgets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String budgetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (budgetName == null) { + return Mono.error(new IllegalArgumentException("Parameter budgetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), scope, this.client.getApiVersion(), budgetName, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String budgetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (budgetName == null) { + return Mono.error(new IllegalArgumentException("Parameter budgetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), scope, this.client.getApiVersion(), budgetName, accept, context); + } + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String budgetName) { + return getWithResponseAsync(scope, budgetName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BudgetInner get(String scope, String budgetName) { + return getAsync(scope, budgetName).block(); + } + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String budgetName, Context context) { + return getWithResponseAsync(scope, budgetName, context).block(); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require + * eTag. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget 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 a budget resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, String budgetName, BudgetInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (budgetName == null) { + return Mono.error(new IllegalArgumentException("Parameter budgetName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + scope, + this.client.getApiVersion(), + budgetName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require + * eTag. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @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 a budget resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, String budgetName, BudgetInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (budgetName == null) { + return Mono.error(new IllegalArgumentException("Parameter budgetName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), scope, this.client.getApiVersion(), budgetName, parameters, accept, context); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require + * eTag. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget 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 a budget resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String scope, String budgetName, BudgetInner parameters) { + return createOrUpdateWithResponseAsync(scope, budgetName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require + * eTag. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget 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 a budget resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BudgetInner createOrUpdate(String scope, String budgetName, BudgetInner parameters) { + return createOrUpdateAsync(scope, budgetName, parameters).block(); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require + * eTag. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @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 a budget resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String scope, String budgetName, BudgetInner parameters, Context context) { + return createOrUpdateWithResponseAsync(scope, budgetName, parameters, context).block(); + } + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String budgetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (budgetName == null) { + return Mono.error(new IllegalArgumentException("Parameter budgetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), scope, this.client.getApiVersion(), budgetName, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String budgetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (budgetName == null) { + return Mono.error(new IllegalArgumentException("Parameter budgetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), scope, this.client.getApiVersion(), budgetName, accept, context); + } + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String budgetName) { + return deleteWithResponseAsync(scope, budgetName).flatMap((Response res) -> Mono.empty()); + } + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String budgetName) { + deleteAsync(scope, budgetName).block(); + } + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String scope, String budgetName, Context context) { + return deleteWithResponseAsync(scope, budgetName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing budgets. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing budgets. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetsImpl.java new file mode 100644 index 0000000000000..582744a9b48e3 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BudgetsImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.core.http.rest.PagedIterable; +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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.BudgetsClient; +import com.azure.resourcemanager.consumption.fluent.models.BudgetInner; +import com.azure.resourcemanager.consumption.models.Budget; +import com.azure.resourcemanager.consumption.models.Budgets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BudgetsImpl implements Budgets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BudgetsImpl.class); + + private final BudgetsClient innerClient; + + private final ConsumptionManager serviceManager; + + public BudgetsImpl(BudgetsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return inner.mapPage(inner1 -> new BudgetImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return inner.mapPage(inner1 -> new BudgetImpl(inner1, this.manager())); + } + + public Budget get(String scope, String budgetName) { + BudgetInner inner = this.serviceClient().get(scope, budgetName); + if (inner != null) { + return new BudgetImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String budgetName, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, budgetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BudgetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String scope, String budgetName) { + this.serviceClient().delete(scope, budgetName); + } + + public Response deleteWithResponse(String scope, String budgetName, Context context) { + return this.serviceClient().deleteWithResponse(scope, budgetName, context); + } + + public Budget getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String budgetName = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "budgetName"); + if (budgetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'budgets'.", id))); + } + return this.getWithResponse(scope, budgetName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String budgetName = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "budgetName"); + if (budgetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'budgets'.", id))); + } + return this.getWithResponse(scope, budgetName, context); + } + + public void deleteById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String budgetName = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "budgetName"); + if (budgetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'budgets'.", id))); + } + this.deleteWithResponse(scope, budgetName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String budgetName = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}", "budgetName"); + if (budgetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'budgets'.", id))); + } + return this.deleteWithResponse(scope, budgetName, context); + } + + private BudgetsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } + + public BudgetImpl define(String name) { + return new BudgetImpl(name, this.manager()); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesClientImpl.java new file mode 100644 index 0000000000000..0d43fe26f25a9 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesClientImpl.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.ChargesClient; +import com.azure.resourcemanager.consumption.fluent.models.ChargesListResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ChargesClient. */ +public final class ChargesClientImpl implements ChargesClient { + private final ClientLogger logger = new ClientLogger(ChargesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ChargesService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ChargesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChargesClientImpl(ConsumptionManagementClientImpl client) { + this.service = RestProxy.create(ChargesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientCharges to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface ChargesService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/charges") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @QueryParam("startDate") String startDate, + @QueryParam("endDate") String endDate, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param startDate Start date. + * @param endDate End date. + * @param filter May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + * 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param apply May be used to group charges for billingAccount scope by properties/billingProfileId, + * properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by + * properties/invoiceSectionId. + * @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 result of listing charge summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String scope, String startDate, String endDate, String filter, String apply) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + scope, + this.client.getApiVersion(), + startDate, + endDate, + filter, + apply, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param startDate Start date. + * @param endDate End date. + * @param filter May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + * 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param apply May be used to group charges for billingAccount scope by properties/billingProfileId, + * properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by + * properties/invoiceSectionId. + * @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 result of listing charge summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String scope, String startDate, String endDate, String filter, String apply, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + scope, + this.client.getApiVersion(), + startDate, + endDate, + filter, + apply, + accept, + context); + } + + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param startDate Start date. + * @param endDate End date. + * @param filter May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + * 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param apply May be used to group charges for billingAccount scope by properties/billingProfileId, + * properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by + * properties/invoiceSectionId. + * @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 result of listing charge summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync( + String scope, String startDate, String endDate, String filter, String apply) { + return listWithResponseAsync(scope, startDate, endDate, filter, apply) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @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 result of listing charge summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String scope) { + final String startDate = null; + final String endDate = null; + final String filter = null; + final String apply = null; + return listWithResponseAsync(scope, startDate, endDate, filter, apply) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @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 result of listing charge summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChargesListResultInner list(String scope) { + final String startDate = null; + final String endDate = null; + final String filter = null; + final String apply = null; + return listAsync(scope, startDate, endDate, filter, apply).block(); + } + + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param startDate Start date. + * @param endDate End date. + * @param filter May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + * 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param apply May be used to group charges for billingAccount scope by properties/billingProfileId, + * properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by + * properties/invoiceSectionId. + * @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 result of listing charge summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String scope, String startDate, String endDate, String filter, String apply, Context context) { + return listWithResponseAsync(scope, startDate, endDate, filter, apply, context).block(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesImpl.java new file mode 100644 index 0000000000000..058593964c481 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.ChargesClient; +import com.azure.resourcemanager.consumption.fluent.models.ChargesListResultInner; +import com.azure.resourcemanager.consumption.models.Charges; +import com.azure.resourcemanager.consumption.models.ChargesListResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ChargesImpl implements Charges { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ChargesImpl.class); + + private final ChargesClient innerClient; + + private final ConsumptionManager serviceManager; + + public ChargesImpl(ChargesClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ChargesListResult list(String scope) { + ChargesListResultInner inner = this.serviceClient().list(scope); + if (inner != null) { + return new ChargesListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String scope, String startDate, String endDate, String filter, String apply, Context context) { + Response inner = + this.serviceClient().listWithResponse(scope, startDate, endDate, filter, apply, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ChargesListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ChargesClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesListResultImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesListResultImpl.java new file mode 100644 index 0000000000000..9b9b430cdfea0 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ChargesListResultImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ChargesListResultInner; +import com.azure.resourcemanager.consumption.models.ChargeSummary; +import com.azure.resourcemanager.consumption.models.ChargesListResult; +import java.util.Collections; +import java.util.List; + +public final class ChargesListResultImpl implements ChargesListResult { + private ChargesListResultInner innerObject; + + private final ConsumptionManager serviceManager; + + ChargesListResultImpl(ChargesListResultInner innerObject, ConsumptionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ChargesListResultInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ConsumptionManagementClientBuilder.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ConsumptionManagementClientBuilder.java new file mode 100644 index 0000000000000..efd5a406aff68 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ConsumptionManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.CookiePolicy; +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 ConsumptionManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ConsumptionManagementClientImpl.class}) +public final class ConsumptionManagementClientBuilder { + /* + * Azure Subscription ID. + */ + private String subscriptionId; + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the ConsumptionManagementClientBuilder. + */ + public ConsumptionManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ConsumptionManagementClientBuilder. + */ + public ConsumptionManagementClientBuilder 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 ConsumptionManagementClientBuilder. + */ + public ConsumptionManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ConsumptionManagementClientBuilder. + */ + public ConsumptionManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ConsumptionManagementClientBuilder. + */ + public ConsumptionManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 ConsumptionManagementClientBuilder. + */ + public ConsumptionManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ConsumptionManagementClientImpl with the provided parameters. + * + * @return an instance of ConsumptionManagementClientImpl. + */ + public ConsumptionManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ConsumptionManagementClientImpl client = + new ConsumptionManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ConsumptionManagementClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 0000000000000..16046e4587b55 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ConsumptionManagementClientImpl.java @@ -0,0 +1,531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.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.consumption.fluent.AggregatedCostsClient; +import com.azure.resourcemanager.consumption.fluent.BalancesClient; +import com.azure.resourcemanager.consumption.fluent.BudgetsClient; +import com.azure.resourcemanager.consumption.fluent.ChargesClient; +import com.azure.resourcemanager.consumption.fluent.ConsumptionManagementClient; +import com.azure.resourcemanager.consumption.fluent.CreditsClient; +import com.azure.resourcemanager.consumption.fluent.EventsOperationsClient; +import com.azure.resourcemanager.consumption.fluent.ForecastsClient; +import com.azure.resourcemanager.consumption.fluent.LotsOperationsClient; +import com.azure.resourcemanager.consumption.fluent.MarketplacesClient; +import com.azure.resourcemanager.consumption.fluent.OperationsClient; +import com.azure.resourcemanager.consumption.fluent.PriceSheetsClient; +import com.azure.resourcemanager.consumption.fluent.ReservationRecommendationDetailsClient; +import com.azure.resourcemanager.consumption.fluent.ReservationRecommendationsClient; +import com.azure.resourcemanager.consumption.fluent.ReservationTransactionsClient; +import com.azure.resourcemanager.consumption.fluent.ReservationsDetailsClient; +import com.azure.resourcemanager.consumption.fluent.ReservationsSummariesClient; +import com.azure.resourcemanager.consumption.fluent.TagsClient; +import com.azure.resourcemanager.consumption.fluent.UsageDetailsClient; +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 java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ConsumptionManagementClientImpl type. */ +@ServiceClient(builder = ConsumptionManagementClientBuilder.class) +public final class ConsumptionManagementClientImpl implements ConsumptionManagementClient { + private final ClientLogger logger = new ClientLogger(ConsumptionManagementClientImpl.class); + + /** Azure Subscription ID. */ + private final String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @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 UsageDetailsClient object to access its operations. */ + private final UsageDetailsClient usageDetails; + + /** + * Gets the UsageDetailsClient object to access its operations. + * + * @return the UsageDetailsClient object. + */ + public UsageDetailsClient getUsageDetails() { + return this.usageDetails; + } + + /** The MarketplacesClient object to access its operations. */ + private final MarketplacesClient marketplaces; + + /** + * Gets the MarketplacesClient object to access its operations. + * + * @return the MarketplacesClient object. + */ + public MarketplacesClient getMarketplaces() { + return this.marketplaces; + } + + /** The BudgetsClient object to access its operations. */ + private final BudgetsClient budgets; + + /** + * Gets the BudgetsClient object to access its operations. + * + * @return the BudgetsClient object. + */ + public BudgetsClient getBudgets() { + return this.budgets; + } + + /** The TagsClient object to access its operations. */ + private final TagsClient tags; + + /** + * Gets the TagsClient object to access its operations. + * + * @return the TagsClient object. + */ + public TagsClient getTags() { + return this.tags; + } + + /** The ChargesClient object to access its operations. */ + private final ChargesClient charges; + + /** + * Gets the ChargesClient object to access its operations. + * + * @return the ChargesClient object. + */ + public ChargesClient getCharges() { + return this.charges; + } + + /** The BalancesClient object to access its operations. */ + private final BalancesClient balances; + + /** + * Gets the BalancesClient object to access its operations. + * + * @return the BalancesClient object. + */ + public BalancesClient getBalances() { + return this.balances; + } + + /** The ReservationsSummariesClient object to access its operations. */ + private final ReservationsSummariesClient reservationsSummaries; + + /** + * Gets the ReservationsSummariesClient object to access its operations. + * + * @return the ReservationsSummariesClient object. + */ + public ReservationsSummariesClient getReservationsSummaries() { + return this.reservationsSummaries; + } + + /** The ReservationsDetailsClient object to access its operations. */ + private final ReservationsDetailsClient reservationsDetails; + + /** + * Gets the ReservationsDetailsClient object to access its operations. + * + * @return the ReservationsDetailsClient object. + */ + public ReservationsDetailsClient getReservationsDetails() { + return this.reservationsDetails; + } + + /** The ReservationRecommendationsClient object to access its operations. */ + private final ReservationRecommendationsClient reservationRecommendations; + + /** + * Gets the ReservationRecommendationsClient object to access its operations. + * + * @return the ReservationRecommendationsClient object. + */ + public ReservationRecommendationsClient getReservationRecommendations() { + return this.reservationRecommendations; + } + + /** The ReservationRecommendationDetailsClient object to access its operations. */ + private final ReservationRecommendationDetailsClient reservationRecommendationDetails; + + /** + * Gets the ReservationRecommendationDetailsClient object to access its operations. + * + * @return the ReservationRecommendationDetailsClient object. + */ + public ReservationRecommendationDetailsClient getReservationRecommendationDetails() { + return this.reservationRecommendationDetails; + } + + /** The ReservationTransactionsClient object to access its operations. */ + private final ReservationTransactionsClient reservationTransactions; + + /** + * Gets the ReservationTransactionsClient object to access its operations. + * + * @return the ReservationTransactionsClient object. + */ + public ReservationTransactionsClient getReservationTransactions() { + return this.reservationTransactions; + } + + /** The PriceSheetsClient object to access its operations. */ + private final PriceSheetsClient priceSheets; + + /** + * Gets the PriceSheetsClient object to access its operations. + * + * @return the PriceSheetsClient object. + */ + public PriceSheetsClient getPriceSheets() { + return this.priceSheets; + } + + /** The ForecastsClient object to access its operations. */ + private final ForecastsClient forecasts; + + /** + * Gets the ForecastsClient object to access its operations. + * + * @return the ForecastsClient object. + */ + public ForecastsClient getForecasts() { + return this.forecasts; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The AggregatedCostsClient object to access its operations. */ + private final AggregatedCostsClient aggregatedCosts; + + /** + * Gets the AggregatedCostsClient object to access its operations. + * + * @return the AggregatedCostsClient object. + */ + public AggregatedCostsClient getAggregatedCosts() { + return this.aggregatedCosts; + } + + /** The EventsOperationsClient object to access its operations. */ + private final EventsOperationsClient eventsOperations; + + /** + * Gets the EventsOperationsClient object to access its operations. + * + * @return the EventsOperationsClient object. + */ + public EventsOperationsClient getEventsOperations() { + return this.eventsOperations; + } + + /** The LotsOperationsClient object to access its operations. */ + private final LotsOperationsClient lotsOperations; + + /** + * Gets the LotsOperationsClient object to access its operations. + * + * @return the LotsOperationsClient object. + */ + public LotsOperationsClient getLotsOperations() { + return this.lotsOperations; + } + + /** The CreditsClient object to access its operations. */ + private final CreditsClient credits; + + /** + * Gets the CreditsClient object to access its operations. + * + * @return the CreditsClient object. + */ + public CreditsClient getCredits() { + return this.credits; + } + + /** + * Initializes an instance of ConsumptionManagementClient 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 Azure Subscription ID. + * @param endpoint server parameter. + */ + ConsumptionManagementClientImpl( + 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 = "2019-10-01"; + this.usageDetails = new UsageDetailsClientImpl(this); + this.marketplaces = new MarketplacesClientImpl(this); + this.budgets = new BudgetsClientImpl(this); + this.tags = new TagsClientImpl(this); + this.charges = new ChargesClientImpl(this); + this.balances = new BalancesClientImpl(this); + this.reservationsSummaries = new ReservationsSummariesClientImpl(this); + this.reservationsDetails = new ReservationsDetailsClientImpl(this); + this.reservationRecommendations = new ReservationRecommendationsClientImpl(this); + this.reservationRecommendationDetails = new ReservationRecommendationDetailsClientImpl(this); + this.reservationTransactions = new ReservationTransactionsClientImpl(this); + this.priceSheets = new PriceSheetsClientImpl(this); + this.forecasts = new ForecastsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.aggregatedCosts = new AggregatedCostsClientImpl(this); + this.eventsOperations = new EventsOperationsClientImpl(this); + this.lotsOperations = new LotsOperationsClientImpl(this); + this.credits = new CreditsClientImpl(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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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 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.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)); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditSummaryImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditSummaryImpl.java new file mode 100644 index 0000000000000..ac199acbbddeb --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditSummaryImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.CreditSummaryInner; +import com.azure.resourcemanager.consumption.models.Amount; +import com.azure.resourcemanager.consumption.models.CreditBalanceSummary; +import com.azure.resourcemanager.consumption.models.CreditSummary; +import java.util.Collections; +import java.util.Map; + +public final class CreditSummaryImpl implements CreditSummary { + private CreditSummaryInner innerObject; + + private final ConsumptionManager serviceManager; + + CreditSummaryImpl(CreditSummaryInner innerObject, ConsumptionManager 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 CreditBalanceSummary balanceSummary() { + return this.innerModel().balanceSummary(); + } + + public Amount pendingCreditAdjustments() { + return this.innerModel().pendingCreditAdjustments(); + } + + public Amount expiredCredit() { + return this.innerModel().expiredCredit(); + } + + public Amount pendingEligibleCharges() { + return this.innerModel().pendingEligibleCharges(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public CreditSummaryInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditsClientImpl.java new file mode 100644 index 0000000000000..adc22ad17248e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditsClientImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.CreditsClient; +import com.azure.resourcemanager.consumption.fluent.models.CreditSummaryInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CreditsClient. */ +public final class CreditsClientImpl implements CreditsClient { + private final ClientLogger logger = new ClientLogger(CreditsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CreditsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of CreditsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CreditsClientImpl(ConsumptionManagementClientImpl client) { + this.service = RestProxy.create(CreditsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientCredits to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface CreditsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}" + + "/providers/Microsoft.Consumption/credits/balanceSummary") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("billingAccountId") String billingAccountId, + @PathParam("billingProfileId") String billingProfileId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingAccountId, String billingProfileId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingProfileId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + billingAccountId, + billingProfileId, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountId, String billingProfileId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingProfileId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + billingAccountId, + billingProfileId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountId, String billingProfileId) { + return getWithResponseAsync(billingAccountId, billingProfileId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CreditSummaryInner get(String billingAccountId, String billingProfileId) { + return getAsync(billingAccountId, billingProfileId).block(); + } + + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String billingAccountId, String billingProfileId, Context context) { + return getWithResponseAsync(billingAccountId, billingProfileId, context).block(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditsImpl.java new file mode 100644 index 0000000000000..bca3acbf41a1c --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/CreditsImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.CreditsClient; +import com.azure.resourcemanager.consumption.fluent.models.CreditSummaryInner; +import com.azure.resourcemanager.consumption.models.CreditSummary; +import com.azure.resourcemanager.consumption.models.Credits; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CreditsImpl implements Credits { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreditsImpl.class); + + private final CreditsClient innerClient; + + private final ConsumptionManager serviceManager; + + public CreditsImpl(CreditsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CreditSummary get(String billingAccountId, String billingProfileId) { + CreditSummaryInner inner = this.serviceClient().get(billingAccountId, billingProfileId); + if (inner != null) { + return new CreditSummaryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String billingAccountId, String billingProfileId, Context context) { + Response inner = + this.serviceClient().getWithResponse(billingAccountId, billingProfileId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CreditSummaryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CreditsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventSummaryImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventSummaryImpl.java new file mode 100644 index 0000000000000..c8d2df96fc4cd --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventSummaryImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.EventSummaryInner; +import com.azure.resourcemanager.consumption.models.Amount; +import com.azure.resourcemanager.consumption.models.EventSummary; +import com.azure.resourcemanager.consumption.models.EventType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class EventSummaryImpl implements EventSummary { + private EventSummaryInner innerObject; + + private final ConsumptionManager serviceManager; + + EventSummaryImpl(EventSummaryInner innerObject, ConsumptionManager 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 OffsetDateTime transactionDate() { + return this.innerModel().transactionDate(); + } + + public String description() { + return this.innerModel().description(); + } + + public Amount newCredit() { + return this.innerModel().newCredit(); + } + + public Amount adjustments() { + return this.innerModel().adjustments(); + } + + public Amount creditExpired() { + return this.innerModel().creditExpired(); + } + + public Amount charges() { + return this.innerModel().charges(); + } + + public Amount closedBalance() { + return this.innerModel().closedBalance(); + } + + public EventType eventType() { + return this.innerModel().eventType(); + } + + public String invoiceNumber() { + return this.innerModel().invoiceNumber(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public EventSummaryInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventsOperationsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventsOperationsClientImpl.java new file mode 100644 index 0000000000000..d37d417bceae9 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventsOperationsClientImpl.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.EventsOperationsClient; +import com.azure.resourcemanager.consumption.fluent.models.EventSummaryInner; +import com.azure.resourcemanager.consumption.models.Events; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EventsOperationsClient. */ +public final class EventsOperationsClientImpl implements EventsOperationsClient { + private final ClientLogger logger = new ClientLogger(EventsOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final EventsOperationsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of EventsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EventsOperationsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(EventsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientEventsOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface EventsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}" + + "/providers/Microsoft.Consumption/events") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("billingAccountId") String billingAccountId, + @PathParam("billingProfileId") String billingProfileId, + @QueryParam("api-version") String apiVersion, + @QueryParam("startDate") String startDate, + @QueryParam("endDate") String endDate, + @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); + } + + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @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 result of listing event summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String billingAccountId, String billingProfileId, String startDate, String endDate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingProfileId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileId is required and cannot be null.")); + } + if (startDate == null) { + return Mono.error(new IllegalArgumentException("Parameter startDate is required and cannot be null.")); + } + if (endDate == null) { + return Mono.error(new IllegalArgumentException("Parameter endDate is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + billingAccountId, + billingProfileId, + this.client.getApiVersion(), + startDate, + endDate, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @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 result of listing event summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String billingAccountId, String billingProfileId, String startDate, String endDate, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingProfileId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileId is required and cannot be null.")); + } + if (startDate == null) { + return Mono.error(new IllegalArgumentException("Parameter startDate is required and cannot be null.")); + } + if (endDate == null) { + return Mono.error(new IllegalArgumentException("Parameter endDate is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + billingAccountId, + billingProfileId, + this.client.getApiVersion(), + startDate, + endDate, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @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 result of listing event summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String billingAccountId, String billingProfileId, String startDate, String endDate) { + return new PagedFlux<>( + () -> listSinglePageAsync(billingAccountId, billingProfileId, startDate, endDate), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @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 result of listing event summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String billingAccountId, String billingProfileId, String startDate, String endDate, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(billingAccountId, billingProfileId, startDate, endDate, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @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 result of listing event summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String billingAccountId, String billingProfileId, String startDate, String endDate) { + return new PagedIterable<>(listAsync(billingAccountId, billingProfileId, startDate, endDate)); + } + + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @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 result of listing event summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String billingAccountId, String billingProfileId, String startDate, String endDate, Context context) { + return new PagedIterable<>(listAsync(billingAccountId, billingProfileId, startDate, endDate, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing event summary. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing event summary. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventsOperationsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventsOperationsImpl.java new file mode 100644 index 0000000000000..06d44eeb1928d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/EventsOperationsImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.EventsOperationsClient; +import com.azure.resourcemanager.consumption.fluent.models.EventSummaryInner; +import com.azure.resourcemanager.consumption.models.EventSummary; +import com.azure.resourcemanager.consumption.models.EventsOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class EventsOperationsImpl implements EventsOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventsOperationsImpl.class); + + private final EventsOperationsClient innerClient; + + private final ConsumptionManager serviceManager; + + public EventsOperationsImpl(EventsOperationsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String billingAccountId, String billingProfileId, String startDate, String endDate) { + PagedIterable inner = + this.serviceClient().list(billingAccountId, billingProfileId, startDate, endDate); + return inner.mapPage(inner1 -> new EventSummaryImpl(inner1, this.manager())); + } + + public PagedIterable list( + String billingAccountId, String billingProfileId, String startDate, String endDate, Context context) { + PagedIterable inner = + this.serviceClient().list(billingAccountId, billingProfileId, startDate, endDate, context); + return inner.mapPage(inner1 -> new EventSummaryImpl(inner1, this.manager())); + } + + private EventsOperationsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastImpl.java new file mode 100644 index 0000000000000..1ef230bacaf8b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastImpl.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ForecastInner; +import com.azure.resourcemanager.consumption.models.ChargeType; +import com.azure.resourcemanager.consumption.models.Forecast; +import com.azure.resourcemanager.consumption.models.ForecastPropertiesConfidenceLevelsItem; +import com.azure.resourcemanager.consumption.models.Grain; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ForecastImpl implements Forecast { + private ForecastInner innerObject; + + private final ConsumptionManager serviceManager; + + ForecastImpl(ForecastInner innerObject, ConsumptionManager 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 String usageDate() { + return this.innerModel().usageDate(); + } + + public Grain grain() { + return this.innerModel().grain(); + } + + public BigDecimal charge() { + return this.innerModel().charge(); + } + + public String currency() { + return this.innerModel().currency(); + } + + public ChargeType chargeType() { + return this.innerModel().chargeType(); + } + + public List confidenceLevels() { + List inner = this.innerModel().confidenceLevels(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ForecastInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastsClientImpl.java new file mode 100644 index 0000000000000..a8c1361ca859b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastsClientImpl.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.ForecastsClient; +import com.azure.resourcemanager.consumption.fluent.models.ForecastInner; +import com.azure.resourcemanager.consumption.models.ForecastsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ForecastsClient. */ +public final class ForecastsClientImpl implements ForecastsClient { + private final ClientLogger logger = new ClientLogger(ForecastsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ForecastsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ForecastsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ForecastsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(ForecastsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientForecasts to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface ForecastsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/forecasts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or + * properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + * 'ne', 'or', or 'not'. + * @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 result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + filter, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or + * properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + * 'ne', 'or', or 'not'. + * @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 result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + filter, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or + * properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + * 'ne', 'or', or 'not'. + * @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 result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter)); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @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 result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter)); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or + * properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + * 'ne', 'or', or 'not'. + * @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 result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, context)); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @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 result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or + * properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + * 'ne', 'or', or 'not'. + * @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 result of listing forecasts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastsImpl.java new file mode 100644 index 0000000000000..6a57cb6022a2d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ForecastsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.ForecastsClient; +import com.azure.resourcemanager.consumption.fluent.models.ForecastInner; +import com.azure.resourcemanager.consumption.models.Forecast; +import com.azure.resourcemanager.consumption.models.Forecasts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ForecastsImpl implements Forecasts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ForecastsImpl.class); + + private final ForecastsClient innerClient; + + private final ConsumptionManager serviceManager; + + public ForecastsImpl(ForecastsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ForecastImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return inner.mapPage(inner1 -> new ForecastImpl(inner1, this.manager())); + } + + private ForecastsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotSummaryImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotSummaryImpl.java new file mode 100644 index 0000000000000..464a7bc76a797 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotSummaryImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.LotSummaryInner; +import com.azure.resourcemanager.consumption.models.Amount; +import com.azure.resourcemanager.consumption.models.LotSource; +import com.azure.resourcemanager.consumption.models.LotSummary; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class LotSummaryImpl implements LotSummary { + private LotSummaryInner innerObject; + + private final ConsumptionManager serviceManager; + + LotSummaryImpl(LotSummaryInner innerObject, ConsumptionManager 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 Amount originalAmount() { + return this.innerModel().originalAmount(); + } + + public Amount closedBalance() { + return this.innerModel().closedBalance(); + } + + public LotSource source() { + return this.innerModel().source(); + } + + public OffsetDateTime startDate() { + return this.innerModel().startDate(); + } + + public OffsetDateTime expirationDate() { + return this.innerModel().expirationDate(); + } + + public String poNumber() { + return this.innerModel().poNumber(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public LotSummaryInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotsOperationsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotsOperationsClientImpl.java new file mode 100644 index 0000000000000..2d284c5961c92 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotsOperationsClientImpl.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.LotsOperationsClient; +import com.azure.resourcemanager.consumption.fluent.models.LotSummaryInner; +import com.azure.resourcemanager.consumption.models.Lots; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LotsOperationsClient. */ +public final class LotsOperationsClientImpl implements LotsOperationsClient { + private final ClientLogger logger = new ClientLogger(LotsOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LotsOperationsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of LotsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LotsOperationsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(LotsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientLotsOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface LotsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}" + + "/providers/Microsoft.Consumption/lots") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("billingAccountId") String billingAccountId, + @PathParam("billingProfileId") String billingProfileId, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing lot summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String billingAccountId, String billingProfileId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingProfileId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + billingAccountId, + billingProfileId, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing lot summary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String billingAccountId, String billingProfileId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingProfileId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + billingAccountId, + billingProfileId, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing lot summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String billingAccountId, String billingProfileId) { + return new PagedFlux<>( + () -> listSinglePageAsync(billingAccountId, billingProfileId), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing lot summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String billingAccountId, String billingProfileId, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(billingAccountId, billingProfileId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing lot summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String billingAccountId, String billingProfileId) { + return new PagedIterable<>(listAsync(billingAccountId, billingProfileId)); + } + + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing lot summary. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String billingAccountId, String billingProfileId, Context context) { + return new PagedIterable<>(listAsync(billingAccountId, billingProfileId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing lot summary. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing lot summary. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotsOperationsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotsOperationsImpl.java new file mode 100644 index 0000000000000..6f95530d59ef1 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/LotsOperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.LotsOperationsClient; +import com.azure.resourcemanager.consumption.fluent.models.LotSummaryInner; +import com.azure.resourcemanager.consumption.models.LotSummary; +import com.azure.resourcemanager.consumption.models.LotsOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LotsOperationsImpl implements LotsOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LotsOperationsImpl.class); + + private final LotsOperationsClient innerClient; + + private final ConsumptionManager serviceManager; + + public LotsOperationsImpl(LotsOperationsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String billingAccountId, String billingProfileId) { + PagedIterable inner = this.serviceClient().list(billingAccountId, billingProfileId); + return inner.mapPage(inner1 -> new LotSummaryImpl(inner1, this.manager())); + } + + public PagedIterable list(String billingAccountId, String billingProfileId, Context context) { + PagedIterable inner = this.serviceClient().list(billingAccountId, billingProfileId, context); + return inner.mapPage(inner1 -> new LotSummaryImpl(inner1, this.manager())); + } + + private LotsOperationsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ManagementGroupAggregatedCostResultImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ManagementGroupAggregatedCostResultImpl.java new file mode 100644 index 0000000000000..0db4cf7bc1cfa --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ManagementGroupAggregatedCostResultImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ManagementGroupAggregatedCostResultInner; +import com.azure.resourcemanager.consumption.models.ManagementGroupAggregatedCostResult; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class ManagementGroupAggregatedCostResultImpl implements ManagementGroupAggregatedCostResult { + private ManagementGroupAggregatedCostResultInner innerObject; + + private final ConsumptionManager serviceManager; + + ManagementGroupAggregatedCostResultImpl( + ManagementGroupAggregatedCostResultInner innerObject, ConsumptionManager 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 String billingPeriodId() { + return this.innerModel().billingPeriodId(); + } + + public OffsetDateTime usageStart() { + return this.innerModel().usageStart(); + } + + public OffsetDateTime usageEnd() { + return this.innerModel().usageEnd(); + } + + public BigDecimal azureCharges() { + return this.innerModel().azureCharges(); + } + + public BigDecimal marketplaceCharges() { + return this.innerModel().marketplaceCharges(); + } + + public BigDecimal chargesBilledSeparately() { + return this.innerModel().chargesBilledSeparately(); + } + + public String currency() { + return this.innerModel().currency(); + } + + public List children() { + List inner = this.innerModel().children(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ManagementGroupAggregatedCostResultImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public List includedSubscriptions() { + List inner = this.innerModel().includedSubscriptions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List excludedSubscriptions() { + List inner = this.innerModel().excludedSubscriptions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagementGroupAggregatedCostResultInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplaceImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplaceImpl.java new file mode 100644 index 0000000000000..1262c8ded5339 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplaceImpl.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.MarketplaceInner; +import com.azure.resourcemanager.consumption.models.Marketplace; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + +public final class MarketplaceImpl implements Marketplace { + private MarketplaceInner innerObject; + + private final ConsumptionManager serviceManager; + + MarketplaceImpl(MarketplaceInner innerObject, ConsumptionManager 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 String billingPeriodId() { + return this.innerModel().billingPeriodId(); + } + + public OffsetDateTime usageStart() { + return this.innerModel().usageStart(); + } + + public OffsetDateTime usageEnd() { + return this.innerModel().usageEnd(); + } + + public BigDecimal resourceRate() { + return this.innerModel().resourceRate(); + } + + public String offerName() { + return this.innerModel().offerName(); + } + + public String resourceGroup() { + return this.innerModel().resourceGroup(); + } + + public String orderNumber() { + return this.innerModel().orderNumber(); + } + + public String instanceName() { + return this.innerModel().instanceName(); + } + + public String instanceId() { + return this.innerModel().instanceId(); + } + + public String currency() { + return this.innerModel().currency(); + } + + public BigDecimal consumedQuantity() { + return this.innerModel().consumedQuantity(); + } + + public String unitOfMeasure() { + return this.innerModel().unitOfMeasure(); + } + + public BigDecimal pretaxCost() { + return this.innerModel().pretaxCost(); + } + + public Boolean isEstimated() { + return this.innerModel().isEstimated(); + } + + public UUID meterId() { + return this.innerModel().meterId(); + } + + public UUID subscriptionGuid() { + return this.innerModel().subscriptionGuid(); + } + + public String subscriptionName() { + return this.innerModel().subscriptionName(); + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public String departmentName() { + return this.innerModel().departmentName(); + } + + public String consumedService() { + return this.innerModel().consumedService(); + } + + public String costCenter() { + return this.innerModel().costCenter(); + } + + public String additionalProperties() { + return this.innerModel().additionalProperties(); + } + + public String publisherName() { + return this.innerModel().publisherName(); + } + + public String planName() { + return this.innerModel().planName(); + } + + public Boolean isRecurringCharge() { + return this.innerModel().isRecurringCharge(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public MarketplaceInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplacesClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplacesClientImpl.java new file mode 100644 index 0000000000000..7b3fb405beb73 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplacesClientImpl.java @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.MarketplacesClient; +import com.azure.resourcemanager.consumption.fluent.models.MarketplaceInner; +import com.azure.resourcemanager.consumption.models.MarketplacesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MarketplacesClient. */ +public final class MarketplacesClientImpl implements MarketplacesClient { + private final ClientLogger logger = new ClientLogger(MarketplacesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MarketplacesService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of MarketplacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MarketplacesClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(MarketplacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientMarketplaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface MarketplacesService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/marketplaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc + * time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', + * 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String filter, Integer top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + filter, + top, + skiptoken, + scope, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc + * time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', + * 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param 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 result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String filter, Integer top, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), filter, top, skiptoken, scope, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc + * time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', + * 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String filter, Integer top, String skiptoken) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, top, skiptoken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @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 result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String filter = null; + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, top, skiptoken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc + * time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', + * 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param 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 result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, String filter, Integer top, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, top, skiptoken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @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 result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String filter = null; + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>(listAsync(scope, filter, top, skiptoken)); + } + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc + * time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', + * 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param 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 result of listing marketplaces. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, String filter, Integer top, String skiptoken, Context context) { + return new PagedIterable<>(listAsync(scope, filter, top, skiptoken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing marketplaces. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing marketplaces. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplacesImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplacesImpl.java new file mode 100644 index 0000000000000..a665eb31e962f --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/MarketplacesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.MarketplacesClient; +import com.azure.resourcemanager.consumption.fluent.models.MarketplaceInner; +import com.azure.resourcemanager.consumption.models.Marketplace; +import com.azure.resourcemanager.consumption.models.Marketplaces; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MarketplacesImpl implements Marketplaces { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplacesImpl.class); + + private final MarketplacesClient innerClient; + + private final ConsumptionManager serviceManager; + + public MarketplacesImpl(MarketplacesClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return inner.mapPage(inner1 -> new MarketplaceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, String filter, Integer top, String skiptoken, Context context) { + PagedIterable inner = this.serviceClient().list(scope, filter, top, skiptoken, context); + return inner.mapPage(inner1 -> new MarketplaceImpl(inner1, this.manager())); + } + + private MarketplacesClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ModernReservationTransactionImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ModernReservationTransactionImpl.java new file mode 100644 index 0000000000000..1f5d9fcf1232e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ModernReservationTransactionImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ModernReservationTransactionInner; +import com.azure.resourcemanager.consumption.models.ModernReservationTransaction; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ModernReservationTransactionImpl implements ModernReservationTransaction { + private ModernReservationTransactionInner innerObject; + + private final ConsumptionManager serviceManager; + + ModernReservationTransactionImpl(ModernReservationTransactionInner innerObject, ConsumptionManager 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 List tags() { + List inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public BigDecimal amount() { + return this.innerModel().amount(); + } + + public String armSkuName() { + return this.innerModel().armSkuName(); + } + + public String billingFrequency() { + return this.innerModel().billingFrequency(); + } + + public String billingProfileId() { + return this.innerModel().billingProfileId(); + } + + public String billingProfileName() { + return this.innerModel().billingProfileName(); + } + + public String currency() { + return this.innerModel().currency(); + } + + public String description() { + return this.innerModel().description(); + } + + public OffsetDateTime eventDate() { + return this.innerModel().eventDate(); + } + + public String eventType() { + return this.innerModel().eventType(); + } + + public String invoice() { + return this.innerModel().invoice(); + } + + public String invoiceId() { + return this.innerModel().invoiceId(); + } + + public String invoiceSectionId() { + return this.innerModel().invoiceSectionId(); + } + + public String invoiceSectionName() { + return this.innerModel().invoiceSectionName(); + } + + public UUID purchasingSubscriptionGuid() { + return this.innerModel().purchasingSubscriptionGuid(); + } + + public String purchasingSubscriptionName() { + return this.innerModel().purchasingSubscriptionName(); + } + + public BigDecimal quantity() { + return this.innerModel().quantity(); + } + + public String region() { + return this.innerModel().region(); + } + + public String reservationOrderId() { + return this.innerModel().reservationOrderId(); + } + + public String reservationOrderName() { + return this.innerModel().reservationOrderName(); + } + + public String term() { + return this.innerModel().term(); + } + + public ModernReservationTransactionInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationImpl.java new file mode 100644 index 0000000000000..14cbe9abe3222 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.OperationInner; +import com.azure.resourcemanager.consumption.models.Operation; +import com.azure.resourcemanager.consumption.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final ConsumptionManager serviceManager; + + OperationImpl(OperationInner innerObject, ConsumptionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..d95daf31ab68d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.OperationsClient; +import com.azure.resourcemanager.consumption.fluent.models.OperationInner; +import com.azure.resourcemanager.consumption.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Consumption/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @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 result of listing consumption operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @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 result of listing consumption operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @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 result of listing consumption operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @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 result of listing consumption operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @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 result of listing consumption operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @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 result of listing consumption operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing consumption operations. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing consumption operations. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..13525e7aa9e32 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.OperationsClient; +import com.azure.resourcemanager.consumption.fluent.models.OperationInner; +import com.azure.resourcemanager.consumption.models.Operation; +import com.azure.resourcemanager.consumption.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final ConsumptionManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetResultImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetResultImpl.java new file mode 100644 index 0000000000000..6df4da18f969e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetResultImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.PriceSheetResultInner; +import com.azure.resourcemanager.consumption.models.PriceSheetProperties; +import com.azure.resourcemanager.consumption.models.PriceSheetResult; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class PriceSheetResultImpl implements PriceSheetResult { + private PriceSheetResultInner innerObject; + + private final ConsumptionManager serviceManager; + + PriceSheetResultImpl(PriceSheetResultInner innerObject, ConsumptionManager 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 List pricesheets() { + List inner = this.innerModel().pricesheets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public PriceSheetResultInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetsClientImpl.java new file mode 100644 index 0000000000000..45242a0f63e2e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetsClientImpl.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.PriceSheetsClient; +import com.azure.resourcemanager.consumption.fluent.models.PriceSheetResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PriceSheetsClient. */ +public final class PriceSheetsClientImpl implements PriceSheetsClient { + private final ClientLogger logger = new ClientLogger(PriceSheetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PriceSheetsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of PriceSheetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PriceSheetsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(PriceSheetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientPriceSheets to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface PriceSheetsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("$top") Integer top, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers" + + "/Microsoft.Consumption/pricesheets/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByBillingPeriod( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("$top") Integer top, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("billingPeriodName") String billingPeriodName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String expand, String skiptoken, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + expand, + skiptoken, + top, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String expand, String skiptoken, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + expand, + skiptoken, + top, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String expand, String skiptoken, Integer top) { + return getWithResponseAsync(expand, skiptoken, top) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @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 price sheet for a scope by subscriptionId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync() { + final String expand = null; + final String skiptoken = null; + final Integer top = null; + return getWithResponseAsync(expand, skiptoken, top) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @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 price sheet for a scope by subscriptionId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PriceSheetResultInner get() { + final String expand = null; + final String skiptoken = null; + final Integer top = null; + return getAsync(expand, skiptoken, top).block(); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String expand, String skiptoken, Integer top, Context context) { + return getWithResponseAsync(expand, skiptoken, top, context).block(); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingPeriodWithResponseAsync( + String billingPeriodName, String expand, String skiptoken, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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.")); + } + if (billingPeriodName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByBillingPeriod( + this.client.getEndpoint(), + expand, + skiptoken, + top, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + billingPeriodName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingPeriodWithResponseAsync( + String billingPeriodName, String expand, String skiptoken, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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.")); + } + if (billingPeriodName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByBillingPeriod( + this.client.getEndpoint(), + expand, + skiptoken, + top, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + billingPeriodName, + accept, + context); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByBillingPeriodAsync( + String billingPeriodName, String expand, String skiptoken, Integer top) { + return getByBillingPeriodWithResponseAsync(billingPeriodName, expand, skiptoken, top) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByBillingPeriodAsync(String billingPeriodName) { + final String expand = null; + final String skiptoken = null; + final Integer top = null; + return getByBillingPeriodWithResponseAsync(billingPeriodName, expand, skiptoken, top) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PriceSheetResultInner getByBillingPeriod(String billingPeriodName) { + final String expand = null; + final String skiptoken = null; + final Integer top = null; + return getByBillingPeriodAsync(billingPeriodName, expand, skiptoken, top).block(); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByBillingPeriodWithResponse( + String billingPeriodName, String expand, String skiptoken, Integer top, Context context) { + return getByBillingPeriodWithResponseAsync(billingPeriodName, expand, skiptoken, top, context).block(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetsImpl.java new file mode 100644 index 0000000000000..1df0edd2c17db --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/PriceSheetsImpl.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.PriceSheetsClient; +import com.azure.resourcemanager.consumption.fluent.models.PriceSheetResultInner; +import com.azure.resourcemanager.consumption.models.PriceSheetResult; +import com.azure.resourcemanager.consumption.models.PriceSheets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PriceSheetsImpl implements PriceSheets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PriceSheetsImpl.class); + + private final PriceSheetsClient innerClient; + + private final ConsumptionManager serviceManager; + + public PriceSheetsImpl(PriceSheetsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PriceSheetResult get() { + PriceSheetResultInner inner = this.serviceClient().get(); + if (inner != null) { + return new PriceSheetResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String expand, String skiptoken, Integer top, Context context) { + Response inner = this.serviceClient().getWithResponse(expand, skiptoken, top, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PriceSheetResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PriceSheetResult getByBillingPeriod(String billingPeriodName) { + PriceSheetResultInner inner = this.serviceClient().getByBillingPeriod(billingPeriodName); + if (inner != null) { + return new PriceSheetResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByBillingPeriodWithResponse( + String billingPeriodName, String expand, String skiptoken, Integer top, Context context) { + Response inner = + this.serviceClient().getByBillingPeriodWithResponse(billingPeriodName, expand, skiptoken, top, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PriceSheetResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PriceSheetsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationDetailImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationDetailImpl.java new file mode 100644 index 0000000000000..a68ce99ce948f --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationDetailImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ReservationDetailInner; +import com.azure.resourcemanager.consumption.models.ReservationDetail; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ReservationDetailImpl implements ReservationDetail { + private ReservationDetailInner innerObject; + + private final ConsumptionManager serviceManager; + + ReservationDetailImpl(ReservationDetailInner innerObject, ConsumptionManager 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 String reservationOrderId() { + return this.innerModel().reservationOrderId(); + } + + public String instanceFlexibilityRatio() { + return this.innerModel().instanceFlexibilityRatio(); + } + + public String instanceFlexibilityGroup() { + return this.innerModel().instanceFlexibilityGroup(); + } + + public String reservationId() { + return this.innerModel().reservationId(); + } + + public String skuName() { + return this.innerModel().skuName(); + } + + public BigDecimal reservedHours() { + return this.innerModel().reservedHours(); + } + + public OffsetDateTime usageDate() { + return this.innerModel().usageDate(); + } + + public BigDecimal usedHours() { + return this.innerModel().usedHours(); + } + + public String instanceId() { + return this.innerModel().instanceId(); + } + + public BigDecimal totalReservedQuantity() { + return this.innerModel().totalReservedQuantity(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ReservationDetailInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsClientImpl.java new file mode 100644 index 0000000000000..46334a051cbb5 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsClientImpl.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.ReservationRecommendationDetailsClient; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationDetailsModelInner; +import com.azure.resourcemanager.consumption.models.LookBackPeriod; +import com.azure.resourcemanager.consumption.models.Scope; +import com.azure.resourcemanager.consumption.models.Term; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ReservationRecommendationDetailsClient. + */ +public final class ReservationRecommendationDetailsClientImpl implements ReservationRecommendationDetailsClient { + private final ClientLogger logger = new ClientLogger(ReservationRecommendationDetailsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReservationRecommendationDetailsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationRecommendationDetailsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReservationRecommendationDetailsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy + .create( + ReservationRecommendationDetailsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientReservationRecommendationDetails to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface ReservationRecommendationDetailsService { + @Headers({"Content-Type: application/json"}) + @Get("/{billingScope}/providers/Microsoft.Consumption/reservationRecommendationDetails") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "billingScope", encoded = true) String billingScope, + @QueryParam("scope") Scope scope, + @QueryParam("region") String region, + @QueryParam("term") Term term, + @QueryParam("lookBackPeriod") LookBackPeriod lookBackPeriod, + @QueryParam("product") String product, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingScope, Scope scope, String region, Term term, LookBackPeriod lookBackPeriod, String product) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingScope == null) { + return Mono.error(new IllegalArgumentException("Parameter billingScope is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (term == null) { + return Mono.error(new IllegalArgumentException("Parameter term is required and cannot be null.")); + } + if (lookBackPeriod == null) { + return Mono.error(new IllegalArgumentException("Parameter lookBackPeriod is required and cannot be null.")); + } + if (product == null) { + return Mono.error(new IllegalArgumentException("Parameter product is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + billingScope, + scope, + region, + term, + lookBackPeriod, + product, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingScope, + Scope scope, + String region, + Term term, + LookBackPeriod lookBackPeriod, + String product, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingScope == null) { + return Mono.error(new IllegalArgumentException("Parameter billingScope is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (term == null) { + return Mono.error(new IllegalArgumentException("Parameter term is required and cannot be null.")); + } + if (lookBackPeriod == null) { + return Mono.error(new IllegalArgumentException("Parameter lookBackPeriod is required and cannot be null.")); + } + if (product == null) { + return Mono.error(new IllegalArgumentException("Parameter product is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + billingScope, + scope, + region, + term, + lookBackPeriod, + product, + accept, + context); + } + + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String billingScope, Scope scope, String region, Term term, LookBackPeriod lookBackPeriod, String product) { + return getWithResponseAsync(billingScope, scope, region, term, lookBackPeriod, product) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReservationRecommendationDetailsModelInner get( + String billingScope, Scope scope, String region, Term term, LookBackPeriod lookBackPeriod, String product) { + return getAsync(billingScope, scope, region, term, lookBackPeriod, product).block(); + } + + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String billingScope, + Scope scope, + String region, + Term term, + LookBackPeriod lookBackPeriod, + String product, + Context context) { + return getWithResponseAsync(billingScope, scope, region, term, lookBackPeriod, product, context).block(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsImpl.java new file mode 100644 index 0000000000000..cf44230d90fed --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.ReservationRecommendationDetailsClient; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationDetailsModelInner; +import com.azure.resourcemanager.consumption.models.LookBackPeriod; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetails; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetailsModel; +import com.azure.resourcemanager.consumption.models.Scope; +import com.azure.resourcemanager.consumption.models.Term; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReservationRecommendationDetailsImpl implements ReservationRecommendationDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationRecommendationDetailsImpl.class); + + private final ReservationRecommendationDetailsClient innerClient; + + private final ConsumptionManager serviceManager; + + public ReservationRecommendationDetailsImpl( + ReservationRecommendationDetailsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ReservationRecommendationDetailsModel get( + String billingScope, Scope scope, String region, Term term, LookBackPeriod lookBackPeriod, String product) { + ReservationRecommendationDetailsModelInner inner = + this.serviceClient().get(billingScope, scope, region, term, lookBackPeriod, product); + if (inner != null) { + return new ReservationRecommendationDetailsModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String billingScope, + Scope scope, + String region, + Term term, + LookBackPeriod lookBackPeriod, + String product, + Context context) { + Response inner = + this.serviceClient().getWithResponse(billingScope, scope, region, term, lookBackPeriod, product, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ReservationRecommendationDetailsModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ReservationRecommendationDetailsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsModelImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsModelImpl.java new file mode 100644 index 0000000000000..e7c7ef656f33f --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationDetailsModelImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationDetailsModelInner; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetailsModel; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetailsResourceProperties; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetailsSavingsProperties; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationDetailsUsageProperties; +import java.util.Collections; +import java.util.Map; + +public final class ReservationRecommendationDetailsModelImpl implements ReservationRecommendationDetailsModel { + private ReservationRecommendationDetailsModelInner innerObject; + + private final ConsumptionManager serviceManager; + + ReservationRecommendationDetailsModelImpl( + ReservationRecommendationDetailsModelInner innerObject, ConsumptionManager 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 String location() { + return this.innerModel().location(); + } + + public String sku() { + return this.innerModel().sku(); + } + + public String currency() { + return this.innerModel().currency(); + } + + public ReservationRecommendationDetailsResourceProperties resource() { + return this.innerModel().resource(); + } + + public String resourceGroup() { + return this.innerModel().resourceGroup(); + } + + public ReservationRecommendationDetailsSavingsProperties savings() { + return this.innerModel().savings(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public ReservationRecommendationDetailsUsageProperties usage() { + return this.innerModel().usage(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ReservationRecommendationDetailsModelInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationImpl.java new file mode 100644 index 0000000000000..19ac9b63443d9 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationInner; +import com.azure.resourcemanager.consumption.models.ReservationRecommendation; +import java.util.Collections; +import java.util.Map; + +public final class ReservationRecommendationImpl implements ReservationRecommendation { + private ReservationRecommendationInner innerObject; + + private final ConsumptionManager serviceManager; + + ReservationRecommendationImpl(ReservationRecommendationInner innerObject, ConsumptionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String location() { + return this.innerModel().location(); + } + + public String sku() { + return this.innerModel().sku(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ReservationRecommendationInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationsClientImpl.java new file mode 100644 index 0000000000000..b9e156d607c8b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationsClientImpl.java @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.ReservationRecommendationsClient; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationInner; +import com.azure.resourcemanager.consumption.models.ReservationRecommendationsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReservationRecommendationsClient. */ +public final class ReservationRecommendationsClientImpl implements ReservationRecommendationsClient { + private final ClientLogger logger = new ClientLogger(ReservationRecommendationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReservationRecommendationsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationRecommendationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReservationRecommendationsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy + .create( + ReservationRecommendationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientReservationRecommendations to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface ReservationRecommendationsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/reservationRecommendations") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param filter May be used to filter reservationRecommendations by: properties/scope with allowed values + * ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values + * ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', + * 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', + * 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values + * ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), filter, this.client.getApiVersion(), scope, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param filter May be used to filter reservationRecommendations by: properties/scope with allowed values + * ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values + * ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', + * 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', + * 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values + * ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, 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 (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), filter, this.client.getApiVersion(), scope, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param filter May be used to filter reservationRecommendations by: properties/scope with allowed values + * ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values + * ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', + * 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', + * 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values + * ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(scope, filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param filter May be used to filter reservationRecommendations by: properties/scope with allowed values + * ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values + * ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', + * 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', + * 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values + * ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String filter = null; + return new PagedIterable<>(listAsync(scope, filter)); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param filter May be used to filter reservationRecommendations by: properties/scope with allowed values + * ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values + * ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', + * 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', + * 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values + * ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String filter, Context context) { + return new PagedIterable<>(listAsync(scope, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationsImpl.java new file mode 100644 index 0000000000000..18c8264d7e87c --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationRecommendationsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.ReservationRecommendationsClient; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationInner; +import com.azure.resourcemanager.consumption.models.ReservationRecommendation; +import com.azure.resourcemanager.consumption.models.ReservationRecommendations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReservationRecommendationsImpl implements ReservationRecommendations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationRecommendationsImpl.class); + + private final ReservationRecommendationsClient innerClient; + + private final ConsumptionManager serviceManager; + + public ReservationRecommendationsImpl( + ReservationRecommendationsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return inner.mapPage(inner1 -> new ReservationRecommendationImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(scope, filter, context); + return inner.mapPage(inner1 -> new ReservationRecommendationImpl(inner1, this.manager())); + } + + private ReservationRecommendationsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationSummaryImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationSummaryImpl.java new file mode 100644 index 0000000000000..b0aa6b299df7a --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationSummaryImpl.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner; +import com.azure.resourcemanager.consumption.models.ReservationSummary; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ReservationSummaryImpl implements ReservationSummary { + private ReservationSummaryInner innerObject; + + private final ConsumptionManager serviceManager; + + ReservationSummaryImpl(ReservationSummaryInner innerObject, ConsumptionManager 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 String reservationOrderId() { + return this.innerModel().reservationOrderId(); + } + + public String reservationId() { + return this.innerModel().reservationId(); + } + + public String skuName() { + return this.innerModel().skuName(); + } + + public BigDecimal reservedHours() { + return this.innerModel().reservedHours(); + } + + public OffsetDateTime usageDate() { + return this.innerModel().usageDate(); + } + + public BigDecimal usedHours() { + return this.innerModel().usedHours(); + } + + public BigDecimal minUtilizationPercentage() { + return this.innerModel().minUtilizationPercentage(); + } + + public BigDecimal avgUtilizationPercentage() { + return this.innerModel().avgUtilizationPercentage(); + } + + public BigDecimal maxUtilizationPercentage() { + return this.innerModel().maxUtilizationPercentage(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public BigDecimal purchasedQuantity() { + return this.innerModel().purchasedQuantity(); + } + + public BigDecimal remainingQuantity() { + return this.innerModel().remainingQuantity(); + } + + public BigDecimal totalReservedQuantity() { + return this.innerModel().totalReservedQuantity(); + } + + public BigDecimal usedQuantity() { + return this.innerModel().usedQuantity(); + } + + public BigDecimal utilizedPercentage() { + return this.innerModel().utilizedPercentage(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ReservationSummaryInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionImpl.java new file mode 100644 index 0000000000000..87b2826d56a44 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.ReservationTransactionInner; +import com.azure.resourcemanager.consumption.models.ReservationTransaction; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ReservationTransactionImpl implements ReservationTransaction { + private ReservationTransactionInner innerObject; + + private final ConsumptionManager serviceManager; + + ReservationTransactionImpl(ReservationTransactionInner innerObject, ConsumptionManager 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 List tags() { + List inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime eventDate() { + return this.innerModel().eventDate(); + } + + public String reservationOrderId() { + return this.innerModel().reservationOrderId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String eventType() { + return this.innerModel().eventType(); + } + + public BigDecimal quantity() { + return this.innerModel().quantity(); + } + + public BigDecimal amount() { + return this.innerModel().amount(); + } + + public String currency() { + return this.innerModel().currency(); + } + + public String reservationOrderName() { + return this.innerModel().reservationOrderName(); + } + + public String purchasingEnrollment() { + return this.innerModel().purchasingEnrollment(); + } + + public UUID purchasingSubscriptionGuid() { + return this.innerModel().purchasingSubscriptionGuid(); + } + + public String purchasingSubscriptionName() { + return this.innerModel().purchasingSubscriptionName(); + } + + public String armSkuName() { + return this.innerModel().armSkuName(); + } + + public String term() { + return this.innerModel().term(); + } + + public String region() { + return this.innerModel().region(); + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public String accountOwnerEmail() { + return this.innerModel().accountOwnerEmail(); + } + + public String departmentName() { + return this.innerModel().departmentName(); + } + + public String costCenter() { + return this.innerModel().costCenter(); + } + + public String currentEnrollment() { + return this.innerModel().currentEnrollment(); + } + + public String billingFrequency() { + return this.innerModel().billingFrequency(); + } + + public ReservationTransactionInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionsClientImpl.java new file mode 100644 index 0000000000000..b14d9cca57550 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionsClientImpl.java @@ -0,0 +1,633 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.ReservationTransactionsClient; +import com.azure.resourcemanager.consumption.fluent.models.ModernReservationTransactionInner; +import com.azure.resourcemanager.consumption.fluent.models.ReservationTransactionInner; +import com.azure.resourcemanager.consumption.models.ModernReservationTransactionsListResult; +import com.azure.resourcemanager.consumption.models.ReservationTransactionsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReservationTransactionsClient. */ +public final class ReservationTransactionsClientImpl implements ReservationTransactionsClient { + private final ClientLogger logger = new ClientLogger(ReservationTransactionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReservationTransactionsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationTransactionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReservationTransactionsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy + .create(ReservationTransactionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientReservationTransactions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface ReservationTransactionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption" + + "/reservationTransactions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountId") String billingAccountId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}" + + "/providers/Microsoft.Consumption/reservationTransactions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountId") String billingAccountId, + @PathParam("billingProfileId") String billingProfileId, + @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); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String billingAccountId, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + filter, + this.client.getApiVersion(), + billingAccountId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String billingAccountId, 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 (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), filter, this.client.getApiVersion(), billingAccountId, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String billingAccountId, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(billingAccountId, filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String billingAccountId) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(billingAccountId, filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String billingAccountId, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(billingAccountId, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String billingAccountId) { + final String filter = null; + return new PagedIterable<>(listAsync(billingAccountId, filter)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String billingAccountId, String filter, Context context) { + return new PagedIterable<>(listAsync(billingAccountId, filter, context)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountId, String billingProfileId, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingProfileId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + filter, + this.client.getApiVersion(), + billingAccountId, + billingProfileId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountId, String billingProfileId, 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 (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + if (billingProfileId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), + filter, + this.client.getApiVersion(), + billingAccountId, + billingProfileId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountId, String billingProfileId, String filter) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountId, billingProfileId, filter), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountId, String billingProfileId) { + final String filter = null; + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountId, billingProfileId, filter), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountId, String billingProfileId, String filter, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountId, billingProfileId, filter, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountId, String billingProfileId) { + final String filter = null; + return new PagedIterable<>(listByBillingProfileAsync(billingAccountId, billingProfileId, filter)); + } + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountId, String billingProfileId, String filter, Context context) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountId, billingProfileId, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @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"; + 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)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionsImpl.java new file mode 100644 index 0000000000000..df10733b69663 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationTransactionsImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.ReservationTransactionsClient; +import com.azure.resourcemanager.consumption.fluent.models.ModernReservationTransactionInner; +import com.azure.resourcemanager.consumption.fluent.models.ReservationTransactionInner; +import com.azure.resourcemanager.consumption.models.ModernReservationTransaction; +import com.azure.resourcemanager.consumption.models.ReservationTransaction; +import com.azure.resourcemanager.consumption.models.ReservationTransactions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReservationTransactionsImpl implements ReservationTransactions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationTransactionsImpl.class); + + private final ReservationTransactionsClient innerClient; + + private final ConsumptionManager serviceManager; + + public ReservationTransactionsImpl(ReservationTransactionsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String billingAccountId) { + PagedIterable inner = this.serviceClient().list(billingAccountId); + return inner.mapPage(inner1 -> new ReservationTransactionImpl(inner1, this.manager())); + } + + public PagedIterable list(String billingAccountId, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(billingAccountId, filter, context); + return inner.mapPage(inner1 -> new ReservationTransactionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountId, String billingProfileId) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountId, billingProfileId); + return inner.mapPage(inner1 -> new ModernReservationTransactionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountId, String billingProfileId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountId, billingProfileId, filter, context); + return inner.mapPage(inner1 -> new ModernReservationTransactionImpl(inner1, this.manager())); + } + + private ReservationTransactionsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsDetailsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsDetailsClientImpl.java new file mode 100644 index 0000000000000..bad245448baa1 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsDetailsClientImpl.java @@ -0,0 +1,992 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.ReservationsDetailsClient; +import com.azure.resourcemanager.consumption.fluent.models.ReservationDetailInner; +import com.azure.resourcemanager.consumption.models.ReservationDetailsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReservationsDetailsClient. */ +public final class ReservationsDetailsClientImpl implements ReservationsDetailsClient { + private final ClientLogger logger = new ClientLogger(ReservationsDetailsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReservationsDetailsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReservationsDetailsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(ReservationsDetailsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientReservationsDetails to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface ReservationsDetailsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption" + + "/reservationDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByReservationOrder( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}" + + "/providers/Microsoft.Consumption/reservationDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByReservationOrderAndReservation( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/reservationDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("startDate") String startDate, + @QueryParam("endDate") String endDate, + @QueryParam("$filter") String filter, + @QueryParam("reservationId") String reservationId, + @QueryParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByReservationOrderNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByReservationOrderAndReservationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderSinglePageAsync( + String reservationOrderId, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByReservationOrder( + this.client.getEndpoint(), + reservationOrderId, + filter, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderSinglePageAsync( + String reservationOrderId, 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 (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByReservationOrder( + this.client.getEndpoint(), reservationOrderId, filter, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAsync(String reservationOrderId, String filter) { + return new PagedFlux<>( + () -> listByReservationOrderSinglePageAsync(reservationOrderId, filter), + nextLink -> listByReservationOrderNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAsync( + String reservationOrderId, String filter, Context context) { + return new PagedFlux<>( + () -> listByReservationOrderSinglePageAsync(reservationOrderId, filter, context), + nextLink -> listByReservationOrderNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByReservationOrder(String reservationOrderId, String filter) { + return new PagedIterable<>(listByReservationOrderAsync(reservationOrderId, filter)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByReservationOrder( + String reservationOrderId, String filter, Context context) { + return new PagedIterable<>(listByReservationOrderAsync(reservationOrderId, filter, context)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderAndReservationSinglePageAsync( + String reservationOrderId, String reservationId, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (reservationId == null) { + return Mono.error(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByReservationOrderAndReservation( + this.client.getEndpoint(), + reservationOrderId, + reservationId, + filter, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderAndReservationSinglePageAsync( + String reservationOrderId, String reservationId, 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 (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (reservationId == null) { + return Mono.error(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByReservationOrderAndReservation( + this.client.getEndpoint(), + reservationOrderId, + reservationId, + filter, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAndReservationAsync( + String reservationOrderId, String reservationId, String filter) { + return new PagedFlux<>( + () -> listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, filter), + nextLink -> listByReservationOrderAndReservationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAndReservationAsync( + String reservationOrderId, String reservationId, String filter, Context context) { + return new PagedFlux<>( + () -> + listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, filter, context), + nextLink -> listByReservationOrderAndReservationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, String filter) { + return new PagedIterable<>( + listByReservationOrderAndReservationAsync(reservationOrderId, reservationId, filter)); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, String filter, Context context) { + return new PagedIterable<>( + listByReservationOrderAndReservationAsync(reservationOrderId, reservationId, filter, context)); + } + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + scope, + startDate, + endDate, + filter, + reservationId, + reservationOrderId, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + scope, + startDate, + endDate, + filter, + reservationId, + reservationOrderId, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, startDate, endDate, filter, reservationId, reservationOrderId), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String startDate = null; + final String endDate = null; + final String filter = null; + final String reservationId = null; + final String reservationOrderId = null; + return new PagedFlux<>( + () -> listSinglePageAsync(scope, startDate, endDate, filter, reservationId, reservationOrderId), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, startDate, endDate, filter, reservationId, reservationOrderId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String startDate = null; + final String endDate = null; + final String filter = null; + final String reservationId = null; + final String reservationOrderId = null; + return new PagedIterable<>(listAsync(scope, startDate, endDate, filter, reservationId, reservationOrderId)); + } + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context) { + return new PagedIterable<>( + listAsync(scope, startDate, endDate, filter, reservationId, reservationOrderId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByReservationOrderNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByReservationOrderNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderAndReservationNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByReservationOrderAndReservationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderAndReservationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByReservationOrderAndReservationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsDetailsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsDetailsImpl.java new file mode 100644 index 0000000000000..f1d6b60d53f52 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsDetailsImpl.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.ReservationsDetailsClient; +import com.azure.resourcemanager.consumption.fluent.models.ReservationDetailInner; +import com.azure.resourcemanager.consumption.models.ReservationDetail; +import com.azure.resourcemanager.consumption.models.ReservationsDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReservationsDetailsImpl implements ReservationsDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationsDetailsImpl.class); + + private final ReservationsDetailsClient innerClient; + + private final ConsumptionManager serviceManager; + + public ReservationsDetailsImpl(ReservationsDetailsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByReservationOrder(String reservationOrderId, String filter) { + PagedIterable inner = + this.serviceClient().listByReservationOrder(reservationOrderId, filter); + return inner.mapPage(inner1 -> new ReservationDetailImpl(inner1, this.manager())); + } + + public PagedIterable listByReservationOrder( + String reservationOrderId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByReservationOrder(reservationOrderId, filter, context); + return inner.mapPage(inner1 -> new ReservationDetailImpl(inner1, this.manager())); + } + + public PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, String filter) { + PagedIterable inner = + this.serviceClient().listByReservationOrderAndReservation(reservationOrderId, reservationId, filter); + return inner.mapPage(inner1 -> new ReservationDetailImpl(inner1, this.manager())); + } + + public PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, String filter, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByReservationOrderAndReservation(reservationOrderId, reservationId, filter, context); + return inner.mapPage(inner1 -> new ReservationDetailImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return inner.mapPage(inner1 -> new ReservationDetailImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context) { + PagedIterable inner = + this.serviceClient().list(scope, startDate, endDate, filter, reservationId, reservationOrderId, context); + return inner.mapPage(inner1 -> new ReservationDetailImpl(inner1, this.manager())); + } + + private ReservationsDetailsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsSummariesClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsSummariesClientImpl.java new file mode 100644 index 0000000000000..d96d15742f6b1 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsSummariesClientImpl.java @@ -0,0 +1,1079 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.ReservationsSummariesClient; +import com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner; +import com.azure.resourcemanager.consumption.models.Datagrain; +import com.azure.resourcemanager.consumption.models.ReservationSummariesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReservationsSummariesClient. */ +public final class ReservationsSummariesClientImpl implements ReservationsSummariesClient { + private final ClientLogger logger = new ClientLogger(ReservationsSummariesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReservationsSummariesService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReservationsSummariesClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy + .create(ReservationsSummariesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientReservationsSummaries to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface ReservationsSummariesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption" + + "/reservationSummaries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByReservationOrder( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("grain") Datagrain grain, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}" + + "/providers/Microsoft.Consumption/reservationSummaries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByReservationOrderAndReservation( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, + @QueryParam("grain") Datagrain grain, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/reservationSummaries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("grain") Datagrain grain, + @QueryParam("startDate") String startDate, + @QueryParam("endDate") String endDate, + @QueryParam("$filter") String filter, + @QueryParam("reservationId") String reservationId, + @QueryParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByReservationOrderNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByReservationOrderAndReservationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderSinglePageAsync( + String reservationOrderId, Datagrain grain, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (grain == null) { + return Mono.error(new IllegalArgumentException("Parameter grain is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByReservationOrder( + this.client.getEndpoint(), + reservationOrderId, + grain, + filter, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderSinglePageAsync( + String reservationOrderId, Datagrain grain, 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 (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (grain == null) { + return Mono.error(new IllegalArgumentException("Parameter grain is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByReservationOrder( + this.client.getEndpoint(), + reservationOrderId, + grain, + filter, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAsync( + String reservationOrderId, Datagrain grain, String filter) { + return new PagedFlux<>( + () -> listByReservationOrderSinglePageAsync(reservationOrderId, grain, filter), + nextLink -> listByReservationOrderNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAsync(String reservationOrderId, Datagrain grain) { + final String filter = null; + return new PagedFlux<>( + () -> listByReservationOrderSinglePageAsync(reservationOrderId, grain, filter), + nextLink -> listByReservationOrderNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAsync( + String reservationOrderId, Datagrain grain, String filter, Context context) { + return new PagedFlux<>( + () -> listByReservationOrderSinglePageAsync(reservationOrderId, grain, filter, context), + nextLink -> listByReservationOrderNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByReservationOrder(String reservationOrderId, Datagrain grain) { + final String filter = null; + return new PagedIterable<>(listByReservationOrderAsync(reservationOrderId, grain, filter)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByReservationOrder( + String reservationOrderId, Datagrain grain, String filter, Context context) { + return new PagedIterable<>(listByReservationOrderAsync(reservationOrderId, grain, filter, context)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderAndReservationSinglePageAsync( + String reservationOrderId, String reservationId, Datagrain grain, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (reservationId == null) { + return Mono.error(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); + } + if (grain == null) { + return Mono.error(new IllegalArgumentException("Parameter grain is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByReservationOrderAndReservation( + this.client.getEndpoint(), + reservationOrderId, + reservationId, + grain, + filter, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderAndReservationSinglePageAsync( + String reservationOrderId, String reservationId, Datagrain grain, 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 (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (reservationId == null) { + return Mono.error(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); + } + if (grain == null) { + return Mono.error(new IllegalArgumentException("Parameter grain is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByReservationOrderAndReservation( + this.client.getEndpoint(), + reservationOrderId, + reservationId, + grain, + filter, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAndReservationAsync( + String reservationOrderId, String reservationId, Datagrain grain, String filter) { + return new PagedFlux<>( + () -> listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, grain, filter), + nextLink -> listByReservationOrderAndReservationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAndReservationAsync( + String reservationOrderId, String reservationId, Datagrain grain) { + final String filter = null; + return new PagedFlux<>( + () -> listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, grain, filter), + nextLink -> listByReservationOrderAndReservationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAndReservationAsync( + String reservationOrderId, String reservationId, Datagrain grain, String filter, Context context) { + return new PagedFlux<>( + () -> + listByReservationOrderAndReservationSinglePageAsync( + reservationOrderId, reservationId, grain, filter, context), + nextLink -> listByReservationOrderAndReservationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, Datagrain grain) { + final String filter = null; + return new PagedIterable<>( + listByReservationOrderAndReservationAsync(reservationOrderId, reservationId, grain, filter)); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, Datagrain grain, String filter, Context context) { + return new PagedIterable<>( + listByReservationOrderAndReservationAsync(reservationOrderId, reservationId, grain, filter, context)); + } + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, + Datagrain grain, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (grain == null) { + return Mono.error(new IllegalArgumentException("Parameter grain is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + scope, + grain, + startDate, + endDate, + filter, + reservationId, + reservationOrderId, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, + Datagrain grain, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (grain == null) { + return Mono.error(new IllegalArgumentException("Parameter grain is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + scope, + grain, + startDate, + endDate, + filter, + reservationId, + reservationOrderId, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, + Datagrain grain, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Datagrain grain) { + final String startDate = null; + final String endDate = null; + final String filter = null; + final String reservationId = null; + final String reservationOrderId = null; + return new PagedFlux<>( + () -> listSinglePageAsync(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, + Datagrain grain, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + scope, grain, startDate, endDate, filter, reservationId, reservationOrderId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Datagrain grain) { + final String startDate = null; + final String endDate = null; + final String filter = null; + final String reservationId = null; + final String reservationOrderId = null; + return new PagedIterable<>( + listAsync(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId)); + } + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, + Datagrain grain, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context) { + return new PagedIterable<>( + listAsync(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByReservationOrderNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByReservationOrderNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderAndReservationNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByReservationOrderAndReservationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByReservationOrderAndReservationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByReservationOrderAndReservationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsSummariesImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsSummariesImpl.java new file mode 100644 index 0000000000000..23d70abd435cc --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.ReservationsSummariesClient; +import com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner; +import com.azure.resourcemanager.consumption.models.Datagrain; +import com.azure.resourcemanager.consumption.models.ReservationSummary; +import com.azure.resourcemanager.consumption.models.ReservationsSummaries; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReservationsSummariesImpl implements ReservationsSummaries { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationsSummariesImpl.class); + + private final ReservationsSummariesClient innerClient; + + private final ConsumptionManager serviceManager; + + public ReservationsSummariesImpl(ReservationsSummariesClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByReservationOrder(String reservationOrderId, Datagrain grain) { + PagedIterable inner = + this.serviceClient().listByReservationOrder(reservationOrderId, grain); + return inner.mapPage(inner1 -> new ReservationSummaryImpl(inner1, this.manager())); + } + + public PagedIterable listByReservationOrder( + String reservationOrderId, Datagrain grain, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByReservationOrder(reservationOrderId, grain, filter, context); + return inner.mapPage(inner1 -> new ReservationSummaryImpl(inner1, this.manager())); + } + + public PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, Datagrain grain) { + PagedIterable inner = + this.serviceClient().listByReservationOrderAndReservation(reservationOrderId, reservationId, grain); + return inner.mapPage(inner1 -> new ReservationSummaryImpl(inner1, this.manager())); + } + + public PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, Datagrain grain, String filter, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByReservationOrderAndReservation(reservationOrderId, reservationId, grain, filter, context); + return inner.mapPage(inner1 -> new ReservationSummaryImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Datagrain grain) { + PagedIterable inner = this.serviceClient().list(scope, grain); + return inner.mapPage(inner1 -> new ReservationSummaryImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, + Datagrain grain, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId, context); + return inner.mapPage(inner1 -> new ReservationSummaryImpl(inner1, this.manager())); + } + + private ReservationsSummariesClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsClientImpl.java new file mode 100644 index 0000000000000..1ea6f6b0e91db --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsClientImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.TagsClient; +import com.azure.resourcemanager.consumption.fluent.models.TagsResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TagsClient. */ +public final class TagsClientImpl implements TagsClient { + private final ClientLogger logger = new ClientLogger(TagsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TagsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of TagsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TagsClientImpl(ConsumptionManagementClientImpl client) { + this.service = RestProxy.create(TagsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientTags to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface TagsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/tags") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @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 all available tag keys for the defined scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @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 all available tag keys for the defined scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context); + } + + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @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 all available tag keys for the defined scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope) { + return getWithResponseAsync(scope) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @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 all available tag keys for the defined scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagsResultInner get(String scope) { + return getAsync(scope).block(); + } + + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @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 all available tag keys for the defined scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, Context context) { + return getWithResponseAsync(scope, context).block(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsImpl.java new file mode 100644 index 0000000000000..69cdee8740e61 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.TagsClient; +import com.azure.resourcemanager.consumption.fluent.models.TagsResultInner; +import com.azure.resourcemanager.consumption.models.Tags; +import com.azure.resourcemanager.consumption.models.TagsResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TagsImpl implements Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsImpl.class); + + private final TagsClient innerClient; + + private final ConsumptionManager serviceManager; + + public TagsImpl(TagsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public TagsResult get(String scope) { + TagsResultInner inner = this.serviceClient().get(scope); + if (inner != null) { + return new TagsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TagsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TagsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsResultImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsResultImpl.java new file mode 100644 index 0000000000000..020091ed20c41 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/TagsResultImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.TagsResultInner; +import com.azure.resourcemanager.consumption.models.Tag; +import com.azure.resourcemanager.consumption.models.TagsResult; +import java.util.Collections; +import java.util.List; + +public final class TagsResultImpl implements TagsResult { + private TagsResultInner innerObject; + + private final ConsumptionManager serviceManager; + + TagsResultImpl(TagsResultInner innerObject, ConsumptionManager 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 List tags() { + List inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public TagsResultInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailImpl.java new file mode 100644 index 0000000000000..8f103d4af261c --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +import com.azure.resourcemanager.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner; +import com.azure.resourcemanager.consumption.models.UsageDetail; +import java.util.Collections; +import java.util.Map; + +public final class UsageDetailImpl implements UsageDetail { + private UsageDetailInner innerObject; + + private final ConsumptionManager serviceManager; + + UsageDetailImpl(UsageDetailInner innerObject, ConsumptionManager 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 Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public UsageDetailInner innerModel() { + return this.innerObject; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailsClientImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailsClientImpl.java new file mode 100644 index 0000000000000..50239b7ad7b7f --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailsClientImpl.java @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.UsageDetailsClient; +import com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner; +import com.azure.resourcemanager.consumption.models.Metrictype; +import com.azure.resourcemanager.consumption.models.UsageDetailsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UsageDetailsClient. */ +public final class UsageDetailsClientImpl implements UsageDetailsClient { + private final ClientLogger logger = new ClientLogger(UsageDetailsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final UsageDetailsService service; + + /** The service client containing this operation class. */ + private final ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of UsageDetailsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsageDetailsClientImpl(ConsumptionManagementClientImpl client) { + this.service = + RestProxy.create(UsageDetailsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConsumptionManagementClientUsageDetails to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConsumptionManagemen") + private interface UsageDetailsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Consumption/usageDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @QueryParam("metric") Metrictype metric, + @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); + } + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param expand May be used to expand the properties/additionalInfo or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, + * properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The + * filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter + * accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param metric Allows to select different type of cost/usage records. + * @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 result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String expand, String filter, String skiptoken, Integer top, Metrictype metric) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + scope, + expand, + filter, + skiptoken, + top, + this.client.getApiVersion(), + metric, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param expand May be used to expand the properties/additionalInfo or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, + * properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The + * filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter + * accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param metric Allows to select different type of cost/usage records. + * @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 result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String expand, String filter, String skiptoken, Integer top, Metrictype metric, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + scope, + expand, + filter, + skiptoken, + top, + this.client.getApiVersion(), + metric, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param expand May be used to expand the properties/additionalInfo or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, + * properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The + * filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter + * accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param metric Allows to select different type of cost/usage records. + * @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 result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, String expand, String filter, String skiptoken, Integer top, Metrictype metric) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expand, filter, skiptoken, top, metric), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @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 result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final Metrictype metric = null; + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expand, filter, skiptoken, top, metric), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param expand May be used to expand the properties/additionalInfo or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, + * properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The + * filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter + * accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param metric Allows to select different type of cost/usage records. + * @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 result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, String expand, String filter, String skiptoken, Integer top, Metrictype metric, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expand, filter, skiptoken, top, metric, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @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 result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final Metrictype metric = null; + return new PagedIterable<>(listAsync(scope, expand, filter, skiptoken, top, metric)); + } + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param expand May be used to expand the properties/additionalInfo or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, + * properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The + * filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter + * accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param metric Allows to select different type of cost/usage records. + * @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 result of listing usage details. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, String expand, String filter, String skiptoken, Integer top, Metrictype metric, Context context) { + return new PagedIterable<>(listAsync(scope, expand, filter, skiptoken, top, metric, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing usage details. + */ + @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"; + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing usage details. + */ + @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"; + 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailsImpl.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailsImpl.java new file mode 100644 index 0000000000000..517af0b951c98 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/UsageDetailsImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.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.consumption.ConsumptionManager; +import com.azure.resourcemanager.consumption.fluent.UsageDetailsClient; +import com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner; +import com.azure.resourcemanager.consumption.models.Metrictype; +import com.azure.resourcemanager.consumption.models.UsageDetail; +import com.azure.resourcemanager.consumption.models.UsageDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class UsageDetailsImpl implements UsageDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageDetailsImpl.class); + + private final UsageDetailsClient innerClient; + + private final ConsumptionManager serviceManager; + + public UsageDetailsImpl(UsageDetailsClient innerClient, ConsumptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return inner.mapPage(inner1 -> new UsageDetailImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, String expand, String filter, String skiptoken, Integer top, Metrictype metric, Context context) { + PagedIterable inner = + this.serviceClient().list(scope, expand, filter, skiptoken, top, metric, context); + return inner.mapPage(inner1 -> new UsageDetailImpl(inner1, this.manager())); + } + + private UsageDetailsClient serviceClient() { + return this.innerClient; + } + + private ConsumptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/Utils.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/Utils.java new file mode 100644 index 0000000000000..7748fe263c3a6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/Utils.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.implementation; + +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; + +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; + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/package-info.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/package-info.java new file mode 100644 index 0000000000000..7ba4ef7a2b535 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 ConsumptionManagementClient. Consumption management client provides access + * to consumption resources for Azure Enterprise Subscriptions. + */ +package com.azure.resourcemanager.consumption.implementation; diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/AggregatedCosts.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/AggregatedCosts.java new file mode 100644 index 0000000000000..4f6201d53e824 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/AggregatedCosts.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AggregatedCosts. */ +public interface AggregatedCosts { + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @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 a management group aggregated cost resource. + */ + ManagementGroupAggregatedCostResult getByManagementGroup(String managementGroupId); + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param filter May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc + * time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', + * or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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 a management group aggregated cost resource. + */ + Response getByManagementGroupWithResponse( + String managementGroupId, String filter, Context context); + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + ManagementGroupAggregatedCostResult getForBillingPeriodByManagementGroup( + String managementGroupId, String billingPeriodName); + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 a management group aggregated cost resource. + */ + Response getForBillingPeriodByManagementGroupWithResponse( + String managementGroupId, String billingPeriodName, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Amount.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Amount.java new file mode 100644 index 0000000000000..60524468cafcd --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Amount.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; + +/** The amount plus currency . */ +@Immutable +public final class Amount { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Amount.class); + + /* + * Amount currency. + */ + @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * Amount. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal value; + + /** + * Get the currency property: Amount currency. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the value property: Amount. + * + * @return the value value. + */ + public BigDecimal value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Balance.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Balance.java new file mode 100644 index 0000000000000..4688ccfec76ac --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Balance.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.BalanceInner; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Balance. */ +public interface Balance { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the currency property: The ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value. + */ + String currency(); + + /** + * Gets the beginningBalance property: The beginning balance for the billing period. + * + * @return the beginningBalance value. + */ + BigDecimal beginningBalance(); + + /** + * Gets the endingBalance property: The ending balance for the billing period (for open periods this will be updated + * daily). + * + * @return the endingBalance value. + */ + BigDecimal endingBalance(); + + /** + * Gets the newPurchases property: Total new purchase amount. + * + * @return the newPurchases value. + */ + BigDecimal newPurchases(); + + /** + * Gets the adjustments property: Total adjustment amount. + * + * @return the adjustments value. + */ + BigDecimal adjustments(); + + /** + * Gets the utilized property: Total Commitment usage. + * + * @return the utilized value. + */ + BigDecimal utilized(); + + /** + * Gets the serviceOverage property: Overage for Azure services. + * + * @return the serviceOverage value. + */ + BigDecimal serviceOverage(); + + /** + * Gets the chargesBilledSeparately property: Charges Billed separately. + * + * @return the chargesBilledSeparately value. + */ + BigDecimal chargesBilledSeparately(); + + /** + * Gets the totalOverage property: serviceOverage + chargesBilledSeparately. + * + * @return the totalOverage value. + */ + BigDecimal totalOverage(); + + /** + * Gets the totalUsage property: Azure service commitment + total Overage. + * + * @return the totalUsage value. + */ + BigDecimal totalUsage(); + + /** + * Gets the azureMarketplaceServiceCharges property: Total charges for Azure Marketplace. + * + * @return the azureMarketplaceServiceCharges value. + */ + BigDecimal azureMarketplaceServiceCharges(); + + /** + * Gets the billingFrequency property: The billing frequency. + * + * @return the billingFrequency value. + */ + BillingFrequency billingFrequency(); + + /** + * Gets the priceHidden property: Price is hidden or not. + * + * @return the priceHidden value. + */ + Boolean priceHidden(); + + /** + * Gets the newPurchasesDetails property: List of new purchases. + * + * @return the newPurchasesDetails value. + */ + List newPurchasesDetails(); + + /** + * Gets the adjustmentDetails property: List of Adjustments (Promo credit, SIE credit etc.). + * + * @return the adjustmentDetails value. + */ + List adjustmentDetails(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.BalanceInner object. + * + * @return the inner object. + */ + BalanceInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BalancePropertiesAdjustmentDetailsItem.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BalancePropertiesAdjustmentDetailsItem.java new file mode 100644 index 0000000000000..28b35f39200b8 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BalancePropertiesAdjustmentDetailsItem.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; + +/** The BalancePropertiesAdjustmentDetailsItem model. */ +@Immutable +public final class BalancePropertiesAdjustmentDetailsItem { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BalancePropertiesAdjustmentDetailsItem.class); + + /* + * the name of new adjustment. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * the value of new adjustment. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal value; + + /** + * Get the name property: the name of new adjustment. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: the value of new adjustment. + * + * @return the value value. + */ + public BigDecimal value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BalancePropertiesNewPurchasesDetailsItem.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BalancePropertiesNewPurchasesDetailsItem.java new file mode 100644 index 0000000000000..88f9ac43b8b41 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BalancePropertiesNewPurchasesDetailsItem.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; + +/** The BalancePropertiesNewPurchasesDetailsItem model. */ +@Immutable +public final class BalancePropertiesNewPurchasesDetailsItem { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BalancePropertiesNewPurchasesDetailsItem.class); + + /* + * the name of new purchase. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * the value of new purchase. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal value; + + /** + * Get the name property: the name of new purchase. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: the value of new purchase. + * + * @return the value value. + */ + public BigDecimal value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Balances.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Balances.java new file mode 100644 index 0000000000000..285e4cd37caa5 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Balances.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Balances. */ +public interface Balances { + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + Balance getByBillingAccount(String billingAccountId); + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or + * later. + * + * @param billingAccountId BillingAccount ID. + * @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 balances for a scope by billingAccountId. + */ + Response getByBillingAccountWithResponse(String billingAccountId, Context context); + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + Balance getForBillingPeriodByBillingAccount(String billingAccountId, String billingPeriodName); + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only + * for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID. + * @param billingPeriodName Billing Period Name. + * @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 balances for a scope by billing period and billingAccountId. + */ + Response getForBillingPeriodByBillingAccountWithResponse( + String billingAccountId, String billingPeriodName, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BillingFrequency.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BillingFrequency.java new file mode 100644 index 0000000000000..9f47894ab8cb0 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BillingFrequency.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BillingFrequency. */ +public final class BillingFrequency extends ExpandableStringEnum { + /** Static value Month for BillingFrequency. */ + public static final BillingFrequency MONTH = fromString("Month"); + + /** Static value Quarter for BillingFrequency. */ + public static final BillingFrequency QUARTER = fromString("Quarter"); + + /** Static value Year for BillingFrequency. */ + public static final BillingFrequency YEAR = fromString("Year"); + + /** + * Creates or finds a BillingFrequency from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingFrequency. + */ + @JsonCreator + public static BillingFrequency fromString(String name) { + return fromString(name, BillingFrequency.class); + } + + /** @return known BillingFrequency values. */ + public static Collection values() { + return values(BillingFrequency.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Bound.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Bound.java new file mode 100644 index 0000000000000..a96a769a96ae8 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Bound.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Bound. */ +public final class Bound extends ExpandableStringEnum { + /** Static value Upper for Bound. */ + public static final Bound UPPER = fromString("Upper"); + + /** Static value Lower for Bound. */ + public static final Bound LOWER = fromString("Lower"); + + /** + * Creates or finds a Bound from its string representation. + * + * @param name a name to look for. + * @return the corresponding Bound. + */ + @JsonCreator + public static Bound fromString(String name) { + return fromString(name, Bound.class); + } + + /** @return known Bound values. */ + public static Collection values() { + return values(Bound.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Budget.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Budget.java new file mode 100644 index 0000000000000..d6a19d5351e02 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Budget.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.consumption.fluent.models.BudgetInner; +import java.math.BigDecimal; +import java.util.Map; + +/** An immutable client-side representation of Budget. */ +public interface Budget { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the category property: The category of the budget, whether the budget tracks cost or usage. + * + * @return the category value. + */ + CategoryType category(); + + /** + * Gets the amount property: The total amount of cost to track with the budget. + * + * @return the amount value. + */ + BigDecimal amount(); + + /** + * Gets the timeGrain property: The time covered by a budget. Tracking of the amount will be reset based on the time + * grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD customers. + * + * @return the timeGrain value. + */ + TimeGrainType timeGrain(); + + /** + * Gets the timePeriod property: Has start and end date of the budget. The start date must be first of the month and + * should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should + * not be more than twelve months. Past start date should be selected within the timegrain period. There are no + * restrictions on the end date. + * + * @return the timePeriod value. + */ + BudgetTimePeriod timePeriod(); + + /** + * Gets the filter property: May be used to filter budgets by resource group, resource, or meter. + * + * @return the filter value. + */ + BudgetFilter filter(); + + /** + * Gets the currentSpend property: The current amount of cost which is being tracked for a budget. + * + * @return the currentSpend value. + */ + CurrentSpend currentSpend(); + + /** + * Gets the notifications property: Dictionary of notifications associated with the budget. Budget can have up to + * five notifications. + * + * @return the notifications value. + */ + Map notifications(); + + /** + * Gets the etag property: eTag of the resource. To handle concurrent update scenario, this field will be used to + * determine whether the user is updating the latest version or not. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.BudgetInner object. + * + * @return the inner object. + */ + BudgetInner innerModel(); + + /** The entirety of the Budget definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The Budget definition stages. */ + interface DefinitionStages { + /** The first stage of the Budget definition. */ + interface Blank extends WithScope { + } + /** The stage of the Budget definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope The scope associated with budget operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + * Department scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + * for Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope. + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the Budget definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithCategory, + DefinitionStages.WithAmount, + DefinitionStages.WithTimeGrain, + DefinitionStages.WithTimePeriod, + DefinitionStages.WithFilter, + DefinitionStages.WithNotifications, + DefinitionStages.WithEtag { + /** + * Executes the create request. + * + * @return the created resource. + */ + Budget create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Budget create(Context context); + } + /** The stage of the Budget definition allowing to specify category. */ + interface WithCategory { + /** + * Specifies the category property: The category of the budget, whether the budget tracks cost or usage.. + * + * @param category The category of the budget, whether the budget tracks cost or usage. + * @return the next definition stage. + */ + WithCreate withCategory(CategoryType category); + } + /** The stage of the Budget definition allowing to specify amount. */ + interface WithAmount { + /** + * Specifies the amount property: The total amount of cost to track with the budget. + * + * @param amount The total amount of cost to track with the budget. + * @return the next definition stage. + */ + WithCreate withAmount(BigDecimal amount); + } + /** The stage of the Budget definition allowing to specify timeGrain. */ + interface WithTimeGrain { + /** + * Specifies the timeGrain property: The time covered by a budget. Tracking of the amount will be reset + * based on the time grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD + * customers. + * + * @param timeGrain The time covered by a budget. Tracking of the amount will be reset based on the time + * grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD customers. + * @return the next definition stage. + */ + WithCreate withTimeGrain(TimeGrainType timeGrain); + } + /** The stage of the Budget definition allowing to specify timePeriod. */ + interface WithTimePeriod { + /** + * Specifies the timePeriod property: Has start and end date of the budget. The start date must be first of + * the month and should be less than the end date. Budget start date must be on or after June 1, 2017. + * Future start date should not be more than twelve months. Past start date should be selected within the + * timegrain period. There are no restrictions on the end date.. + * + * @param timePeriod Has start and end date of the budget. The start date must be first of the month and + * should be less than the end date. Budget start date must be on or after June 1, 2017. Future start + * date should not be more than twelve months. Past start date should be selected within the timegrain + * period. There are no restrictions on the end date. + * @return the next definition stage. + */ + WithCreate withTimePeriod(BudgetTimePeriod timePeriod); + } + /** The stage of the Budget definition allowing to specify filter. */ + interface WithFilter { + /** + * Specifies the filter property: May be used to filter budgets by resource group, resource, or meter.. + * + * @param filter May be used to filter budgets by resource group, resource, or meter. + * @return the next definition stage. + */ + WithCreate withFilter(BudgetFilter filter); + } + /** The stage of the Budget definition allowing to specify notifications. */ + interface WithNotifications { + /** + * Specifies the notifications property: Dictionary of notifications associated with the budget. Budget can + * have up to five notifications.. + * + * @param notifications Dictionary of notifications associated with the budget. Budget can have up to five + * notifications. + * @return the next definition stage. + */ + WithCreate withNotifications(Map notifications); + } + /** The stage of the Budget definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: eTag of the resource. To handle concurrent update scenario, this field will + * be used to determine whether the user is updating the latest version or not.. + * + * @param etag eTag of the resource. To handle concurrent update scenario, this field will be used to + * determine whether the user is updating the latest version or not. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + } + /** + * Begins update for the Budget resource. + * + * @return the stage of resource update. + */ + Budget.Update update(); + + /** The template for Budget update. */ + interface Update + extends UpdateStages.WithCategory, + UpdateStages.WithAmount, + UpdateStages.WithTimeGrain, + UpdateStages.WithTimePeriod, + UpdateStages.WithFilter, + UpdateStages.WithNotifications, + UpdateStages.WithEtag { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Budget apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Budget apply(Context context); + } + /** The Budget update stages. */ + interface UpdateStages { + /** The stage of the Budget update allowing to specify category. */ + interface WithCategory { + /** + * Specifies the category property: The category of the budget, whether the budget tracks cost or usage.. + * + * @param category The category of the budget, whether the budget tracks cost or usage. + * @return the next definition stage. + */ + Update withCategory(CategoryType category); + } + /** The stage of the Budget update allowing to specify amount. */ + interface WithAmount { + /** + * Specifies the amount property: The total amount of cost to track with the budget. + * + * @param amount The total amount of cost to track with the budget. + * @return the next definition stage. + */ + Update withAmount(BigDecimal amount); + } + /** The stage of the Budget update allowing to specify timeGrain. */ + interface WithTimeGrain { + /** + * Specifies the timeGrain property: The time covered by a budget. Tracking of the amount will be reset + * based on the time grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD + * customers. + * + * @param timeGrain The time covered by a budget. Tracking of the amount will be reset based on the time + * grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD customers. + * @return the next definition stage. + */ + Update withTimeGrain(TimeGrainType timeGrain); + } + /** The stage of the Budget update allowing to specify timePeriod. */ + interface WithTimePeriod { + /** + * Specifies the timePeriod property: Has start and end date of the budget. The start date must be first of + * the month and should be less than the end date. Budget start date must be on or after June 1, 2017. + * Future start date should not be more than twelve months. Past start date should be selected within the + * timegrain period. There are no restrictions on the end date.. + * + * @param timePeriod Has start and end date of the budget. The start date must be first of the month and + * should be less than the end date. Budget start date must be on or after June 1, 2017. Future start + * date should not be more than twelve months. Past start date should be selected within the timegrain + * period. There are no restrictions on the end date. + * @return the next definition stage. + */ + Update withTimePeriod(BudgetTimePeriod timePeriod); + } + /** The stage of the Budget update allowing to specify filter. */ + interface WithFilter { + /** + * Specifies the filter property: May be used to filter budgets by resource group, resource, or meter.. + * + * @param filter May be used to filter budgets by resource group, resource, or meter. + * @return the next definition stage. + */ + Update withFilter(BudgetFilter filter); + } + /** The stage of the Budget update allowing to specify notifications. */ + interface WithNotifications { + /** + * Specifies the notifications property: Dictionary of notifications associated with the budget. Budget can + * have up to five notifications.. + * + * @param notifications Dictionary of notifications associated with the budget. Budget can have up to five + * notifications. + * @return the next definition stage. + */ + Update withNotifications(Map notifications); + } + /** The stage of the Budget update allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: eTag of the resource. To handle concurrent update scenario, this field will + * be used to determine whether the user is updating the latest version or not.. + * + * @param etag eTag of the resource. To handle concurrent update scenario, this field will be used to + * determine whether the user is updating the latest version or not. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Budget refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Budget refresh(Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetComparisonExpression.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetComparisonExpression.java new file mode 100644 index 0000000000000..6c4ec428fb0db --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetComparisonExpression.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The comparison expression to be used in the budgets. */ +@Fluent +public final class BudgetComparisonExpression { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BudgetComparisonExpression.class); + + /* + * The name of the column to use in comparison. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The operator to use for comparison. + */ + @JsonProperty(value = "operator", required = true) + private BudgetOperatorType operator; + + /* + * Array of values to use for comparison + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * Get the name property: The name of the column to use in comparison. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the column to use in comparison. + * + * @param name the name value to set. + * @return the BudgetComparisonExpression object itself. + */ + public BudgetComparisonExpression withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operator property: The operator to use for comparison. + * + * @return the operator value. + */ + public BudgetOperatorType operator() { + return this.operator; + } + + /** + * Set the operator property: The operator to use for comparison. + * + * @param operator the operator value to set. + * @return the BudgetComparisonExpression object itself. + */ + public BudgetComparisonExpression withOperator(BudgetOperatorType operator) { + this.operator = operator; + return this; + } + + /** + * Get the values property: Array of values to use for comparison. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: Array of values to use for comparison. + * + * @param values the values value to set. + * @return the BudgetComparisonExpression object itself. + */ + public BudgetComparisonExpression withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model BudgetComparisonExpression")); + } + if (operator() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operator in model BudgetComparisonExpression")); + } + if (values() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property values in model BudgetComparisonExpression")); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetFilter.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetFilter.java new file mode 100644 index 0000000000000..7af3aa43443e0 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetFilter.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** May be used to filter budgets by resource group, resource, or meter. */ +@Fluent +public final class BudgetFilter { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BudgetFilter.class); + + /* + * The logical "AND" expression. Must have at least 2 items. + */ + @JsonProperty(value = "and") + private List and; + + /* + * The logical "NOT" expression. + */ + @JsonProperty(value = "not") + private BudgetFilterProperties not; + + /* + * Has comparison expression for a dimension + */ + @JsonProperty(value = "dimensions") + private BudgetComparisonExpression dimensions; + + /* + * Has comparison expression for a tag + */ + @JsonProperty(value = "tags") + private BudgetComparisonExpression tags; + + /** + * Get the and property: The logical "AND" expression. Must have at least 2 items. + * + * @return the and value. + */ + public List and() { + return this.and; + } + + /** + * Set the and property: The logical "AND" expression. Must have at least 2 items. + * + * @param and the and value to set. + * @return the BudgetFilter object itself. + */ + public BudgetFilter withAnd(List and) { + this.and = and; + return this; + } + + /** + * Get the not property: The logical "NOT" expression. + * + * @return the not value. + */ + public BudgetFilterProperties not() { + return this.not; + } + + /** + * Set the not property: The logical "NOT" expression. + * + * @param not the not value to set. + * @return the BudgetFilter object itself. + */ + public BudgetFilter withNot(BudgetFilterProperties not) { + this.not = not; + return this; + } + + /** + * Get the dimensions property: Has comparison expression for a dimension. + * + * @return the dimensions value. + */ + public BudgetComparisonExpression dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: Has comparison expression for a dimension. + * + * @param dimensions the dimensions value to set. + * @return the BudgetFilter object itself. + */ + public BudgetFilter withDimensions(BudgetComparisonExpression dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the tags property: Has comparison expression for a tag. + * + * @return the tags value. + */ + public BudgetComparisonExpression tags() { + return this.tags; + } + + /** + * Set the tags property: Has comparison expression for a tag. + * + * @param tags the tags value to set. + * @return the BudgetFilter object itself. + */ + public BudgetFilter withTags(BudgetComparisonExpression tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (and() != null) { + and().forEach(e -> e.validate()); + } + if (not() != null) { + not().validate(); + } + if (dimensions() != null) { + dimensions().validate(); + } + if (tags() != null) { + tags().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetFilterProperties.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetFilterProperties.java new file mode 100644 index 0000000000000..42ff353a3e6cc --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetFilterProperties.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Dimensions or Tags to filter a budget by. */ +@Fluent +public final class BudgetFilterProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BudgetFilterProperties.class); + + /* + * Has comparison expression for a dimension + */ + @JsonProperty(value = "dimensions") + private BudgetComparisonExpression dimensions; + + /* + * Has comparison expression for a tag + */ + @JsonProperty(value = "tags") + private BudgetComparisonExpression tags; + + /** + * Get the dimensions property: Has comparison expression for a dimension. + * + * @return the dimensions value. + */ + public BudgetComparisonExpression dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: Has comparison expression for a dimension. + * + * @param dimensions the dimensions value to set. + * @return the BudgetFilterProperties object itself. + */ + public BudgetFilterProperties withDimensions(BudgetComparisonExpression dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the tags property: Has comparison expression for a tag. + * + * @return the tags value. + */ + public BudgetComparisonExpression tags() { + return this.tags; + } + + /** + * Set the tags property: Has comparison expression for a tag. + * + * @param tags the tags value to set. + * @return the BudgetFilterProperties object itself. + */ + public BudgetFilterProperties withTags(BudgetComparisonExpression tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dimensions() != null) { + dimensions().validate(); + } + if (tags() != null) { + tags().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetOperatorType.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetOperatorType.java new file mode 100644 index 0000000000000..605b90e98c054 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetOperatorType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BudgetOperatorType. */ +public final class BudgetOperatorType extends ExpandableStringEnum { + /** Static value In for BudgetOperatorType. */ + public static final BudgetOperatorType IN = fromString("In"); + + /** + * Creates or finds a BudgetOperatorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BudgetOperatorType. + */ + @JsonCreator + public static BudgetOperatorType fromString(String name) { + return fromString(name, BudgetOperatorType.class); + } + + /** @return known BudgetOperatorType values. */ + public static Collection values() { + return values(BudgetOperatorType.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetTimePeriod.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetTimePeriod.java new file mode 100644 index 0000000000000..05a038d2a479e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetTimePeriod.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The start and end date for a budget. */ +@Fluent +public final class BudgetTimePeriod { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BudgetTimePeriod.class); + + /* + * The start date for the budget. + */ + @JsonProperty(value = "startDate", required = true) + private OffsetDateTime startDate; + + /* + * The end date for the budget. If not provided, we default this to 10 + * years from the start date. + */ + @JsonProperty(value = "endDate") + private OffsetDateTime endDate; + + /** + * Get the startDate property: The start date for the budget. + * + * @return the startDate value. + */ + public OffsetDateTime startDate() { + return this.startDate; + } + + /** + * Set the startDate property: The start date for the budget. + * + * @param startDate the startDate value to set. + * @return the BudgetTimePeriod object itself. + */ + public BudgetTimePeriod withStartDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the endDate property: The end date for the budget. If not provided, we default this to 10 years from the + * start date. + * + * @return the endDate value. + */ + public OffsetDateTime endDate() { + return this.endDate; + } + + /** + * Set the endDate property: The end date for the budget. If not provided, we default this to 10 years from the + * start date. + * + * @param endDate the endDate value to set. + * @return the BudgetTimePeriod object itself. + */ + public BudgetTimePeriod withEndDate(OffsetDateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startDate() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property startDate in model BudgetTimePeriod")); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Budgets.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Budgets.java new file mode 100644 index 0000000000000..30473f648fac7 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Budgets.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Budgets. */ +public interface Budgets { + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing budgets. + */ + PagedIterable list(String scope); + + /** + * Lists all budgets for the defined scope. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing budgets. + */ + PagedIterable list(String scope, Context context); + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + Budget get(String scope, String budgetName); + + /** + * Gets the budget for the scope by budget name. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 budget for the scope by budget name. + */ + Response getWithResponse(String scope, String budgetName, Context context); + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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. + */ + void deleteByResourceGroup(String scope, String budgetName); + + /** + * The operation to delete a budget. + * + * @param scope The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for + * invoiceSection scope. + * @param budgetName Budget Name. + * @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 response. + */ + Response deleteWithResponse(String scope, String budgetName, Context context); + + /** + * Gets the budget for the scope by budget name. + * + * @param id the resource ID. + * @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 budget for the scope by budget name. + */ + Budget getById(String id); + + /** + * Gets the budget for the scope by budget name. + * + * @param id the resource ID. + * @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 budget for the scope by budget name. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete a budget. + * + * @param id the resource ID. + * @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. + */ + void deleteById(String id); + + /** + * The operation to delete a budget. + * + * @param id the resource ID. + * @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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Budget resource. + * + * @param name resource name. + * @return the first stage of the new Budget definition. + */ + Budget.DefinitionStages.Blank define(String name); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetsListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetsListResult.java new file mode 100644 index 0000000000000..bd33a65c2a2b6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/BudgetsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.BudgetInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing budgets. It contains a list of available budgets in the scope provided. */ +@Immutable +public final class BudgetsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BudgetsListResult.class); + + /* + * The list of budgets. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of budgets. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CategoryType.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CategoryType.java new file mode 100644 index 0000000000000..cbdbc833c36e1 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CategoryType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CategoryType. */ +public final class CategoryType extends ExpandableStringEnum { + /** Static value Cost for CategoryType. */ + public static final CategoryType COST = fromString("Cost"); + + /** + * Creates or finds a CategoryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CategoryType. + */ + @JsonCreator + public static CategoryType fromString(String name) { + return fromString(name, CategoryType.class); + } + + /** @return known CategoryType values. */ + public static Collection values() { + return values(CategoryType.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeSummary.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeSummary.java new file mode 100644 index 0000000000000..93a5315546e98 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeSummary.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +/** A charge summary resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = ChargeSummary.class) +@JsonTypeName("ChargeSummary") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "legacy", value = LegacyChargeSummary.class), + @JsonSubTypes.Type(name = "modern", value = ModernChargeSummary.class) +}) +@Immutable +public class ChargeSummary extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ChargeSummary.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeSummaryKind.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeSummaryKind.java new file mode 100644 index 0000000000000..73c6df33f98c6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeSummaryKind.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ChargeSummaryKind. */ +public final class ChargeSummaryKind extends ExpandableStringEnum { + /** Static value legacy for ChargeSummaryKind. */ + public static final ChargeSummaryKind LEGACY = fromString("legacy"); + + /** Static value modern for ChargeSummaryKind. */ + public static final ChargeSummaryKind MODERN = fromString("modern"); + + /** + * Creates or finds a ChargeSummaryKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChargeSummaryKind. + */ + @JsonCreator + public static ChargeSummaryKind fromString(String name) { + return fromString(name, ChargeSummaryKind.class); + } + + /** @return known ChargeSummaryKind values. */ + public static Collection values() { + return values(ChargeSummaryKind.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeType.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeType.java new file mode 100644 index 0000000000000..2cc2e9a0a6187 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargeType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ChargeType. */ +public final class ChargeType extends ExpandableStringEnum { + /** Static value Actual for ChargeType. */ + public static final ChargeType ACTUAL = fromString("Actual"); + + /** Static value Forecast for ChargeType. */ + public static final ChargeType FORECAST = fromString("Forecast"); + + /** + * Creates or finds a ChargeType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChargeType. + */ + @JsonCreator + public static ChargeType fromString(String name) { + return fromString(name, ChargeType.class); + } + + /** @return known ChargeType values. */ + public static Collection values() { + return values(ChargeType.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Charges.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Charges.java new file mode 100644 index 0000000000000..16f0b73abd97a --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Charges.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Charges. */ +public interface Charges { + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing charge summary. + */ + ChargesListResult list(String scope); + + /** + * Lists the charges based for the defined scope. + * + * @param scope The scope associated with charges operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the + * scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing + * period at department scope use + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param startDate Start date. + * @param endDate End date. + * @param filter May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + * 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param apply May be used to group charges for billingAccount scope by properties/billingProfileId, + * properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by + * properties/invoiceSectionId. + * @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 result of listing charge summary. + */ + Response listWithResponse( + String scope, String startDate, String endDate, String filter, String apply, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargesListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargesListResult.java new file mode 100644 index 0000000000000..697e150fd1078 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ChargesListResult.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ChargesListResultInner; +import java.util.List; + +/** An immutable client-side representation of ChargesListResult. */ +public interface ChargesListResult { + /** + * Gets the value property: The list of charge summary. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ChargesListResultInner object. + * + * @return the inner object. + */ + ChargesListResultInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CreditBalanceSummary.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CreditBalanceSummary.java new file mode 100644 index 0000000000000..75c919a8929bf --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CreditBalanceSummary.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Summary of credit balances. */ +@Immutable +public final class CreditBalanceSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreditBalanceSummary.class); + + /* + * Estimated balance. + */ + @JsonProperty(value = "estimatedBalance", access = JsonProperty.Access.WRITE_ONLY) + private Amount estimatedBalance; + + /* + * Current balance. + */ + @JsonProperty(value = "currentBalance", access = JsonProperty.Access.WRITE_ONLY) + private Amount currentBalance; + + /** + * Get the estimatedBalance property: Estimated balance. + * + * @return the estimatedBalance value. + */ + public Amount estimatedBalance() { + return this.estimatedBalance; + } + + /** + * Get the currentBalance property: Current balance. + * + * @return the currentBalance value. + */ + public Amount currentBalance() { + return this.currentBalance; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (estimatedBalance() != null) { + estimatedBalance().validate(); + } + if (currentBalance() != null) { + currentBalance().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CreditSummary.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CreditSummary.java new file mode 100644 index 0000000000000..c2f8202d7456f --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CreditSummary.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.CreditSummaryInner; +import java.util.Map; + +/** An immutable client-side representation of CreditSummary. */ +public interface CreditSummary { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the balanceSummary property: Summary of balances associated with this credit summary. + * + * @return the balanceSummary value. + */ + CreditBalanceSummary balanceSummary(); + + /** + * Gets the pendingCreditAdjustments property: Pending credit adjustments. + * + * @return the pendingCreditAdjustments value. + */ + Amount pendingCreditAdjustments(); + + /** + * Gets the expiredCredit property: Expired credit. + * + * @return the expiredCredit value. + */ + Amount expiredCredit(); + + /** + * Gets the pendingEligibleCharges property: Pending eligible charges. + * + * @return the pendingEligibleCharges value. + */ + Amount pendingEligibleCharges(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.CreditSummaryInner object. + * + * @return the inner object. + */ + CreditSummaryInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Credits.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Credits.java new file mode 100644 index 0000000000000..c81237f13f378 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Credits.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Credits. */ +public interface Credits { + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + CreditSummary get(String billingAccountId, String billingProfileId); + + /** + * The credit summary by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 a credit summary resource. + */ + Response getWithResponse(String billingAccountId, String billingProfileId, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CurrentSpend.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CurrentSpend.java new file mode 100644 index 0000000000000..7d1ef07753c7e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/CurrentSpend.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; + +/** The current amount of cost which is being tracked for a budget. */ +@Immutable +public final class CurrentSpend { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CurrentSpend.class); + + /* + * The total amount of cost which is being tracked by the budget. + */ + @JsonProperty(value = "amount", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal amount; + + /* + * The unit of measure for the budget amount. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Get the amount property: The total amount of cost which is being tracked by the budget. + * + * @return the amount value. + */ + public BigDecimal amount() { + return this.amount; + } + + /** + * Get the unit property: The unit of measure for the budget amount. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Datagrain.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Datagrain.java new file mode 100644 index 0000000000000..d1552a898e916 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Datagrain.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Datagrain. */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * + * @param name a name to look for. + * @return the corresponding Datagrain. + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** @return known Datagrain values. */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventSummary.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventSummary.java new file mode 100644 index 0000000000000..0904ea63ca0a5 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventSummary.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.EventSummaryInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of EventSummary. */ +public interface EventSummary { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the transactionDate property: Transaction date. + * + * @return the transactionDate value. + */ + OffsetDateTime transactionDate(); + + /** + * Gets the description property: Transaction description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the newCredit property: New Credit. + * + * @return the newCredit value. + */ + Amount newCredit(); + + /** + * Gets the adjustments property: Adjustments amount. + * + * @return the adjustments value. + */ + Amount adjustments(); + + /** + * Gets the creditExpired property: Credit expired. + * + * @return the creditExpired value. + */ + Amount creditExpired(); + + /** + * Gets the charges property: Charges amount. + * + * @return the charges value. + */ + Amount charges(); + + /** + * Gets the closedBalance property: Closed balance. + * + * @return the closedBalance value. + */ + Amount closedBalance(); + + /** + * Gets the eventType property: The type of event. + * + * @return the eventType value. + */ + EventType eventType(); + + /** + * Gets the invoiceNumber property: Invoice number. + * + * @return the invoiceNumber value. + */ + String invoiceNumber(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.EventSummaryInner object. + * + * @return the inner object. + */ + EventSummaryInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventType.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventType.java new file mode 100644 index 0000000000000..f5962311e4e55 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventType.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EventType. */ +public final class EventType extends ExpandableStringEnum { + /** Static value SettledCharges for EventType. */ + public static final EventType SETTLED_CHARGES = fromString("SettledCharges"); + + /** Static value PendingCharges for EventType. */ + public static final EventType PENDING_CHARGES = fromString("PendingCharges"); + + /** Static value PendingAdjustments for EventType. */ + public static final EventType PENDING_ADJUSTMENTS = fromString("PendingAdjustments"); + + /** Static value PendingNewCredit for EventType. */ + public static final EventType PENDING_NEW_CREDIT = fromString("PendingNewCredit"); + + /** Static value PendingExpiredCredit for EventType. */ + public static final EventType PENDING_EXPIRED_CREDIT = fromString("PendingExpiredCredit"); + + /** Static value UnKnown for EventType. */ + public static final EventType UN_KNOWN = fromString("UnKnown"); + + /** Static value NewCredit for EventType. */ + public static final EventType NEW_CREDIT = fromString("NewCredit"); + + /** + * Creates or finds a EventType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventType. + */ + @JsonCreator + public static EventType fromString(String name) { + return fromString(name, EventType.class); + } + + /** @return known EventType values. */ + public static Collection values() { + return values(EventType.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Events.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Events.java new file mode 100644 index 0000000000000..f2c17db4b19bd --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Events.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.EventSummaryInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing event summary. */ +@Immutable +public final class Events { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Events.class); + + /* + * The list of event summary. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of event summary. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventsOperations.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventsOperations.java new file mode 100644 index 0000000000000..2c66484154511 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/EventsOperations.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of EventsOperations. */ +public interface EventsOperations { + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing event summary. + */ + PagedIterable list( + String billingAccountId, String billingProfileId, String startDate, String endDate); + + /** + * Lists the events by billingAccountId and billingProfileId for given start and end date. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param startDate Start date. + * @param endDate End date. + * @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 result of listing event summary. + */ + PagedIterable list( + String billingAccountId, String billingProfileId, String startDate, String endDate, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Forecast.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Forecast.java new file mode 100644 index 0000000000000..3871f33705ceb --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Forecast.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ForecastInner; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Forecast. */ +public interface Forecast { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the usageDate property: The usage date of the forecast. + * + * @return the usageDate value. + */ + String usageDate(); + + /** + * Gets the grain property: The granularity of forecast. + * + * @return the grain value. + */ + Grain grain(); + + /** + * Gets the charge property: The amount of charge. + * + * @return the charge value. + */ + BigDecimal charge(); + + /** + * Gets the currency property: The ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value. + */ + String currency(); + + /** + * Gets the chargeType property: The type of the charge. Could be actual or forecast. + * + * @return the chargeType value. + */ + ChargeType chargeType(); + + /** + * Gets the confidenceLevels property: The details about the forecast confidence levels. This is populated only when + * chargeType is Forecast. + * + * @return the confidenceLevels value. + */ + List confidenceLevels(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ForecastInner object. + * + * @return the inner object. + */ + ForecastInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ForecastPropertiesConfidenceLevelsItem.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ForecastPropertiesConfidenceLevelsItem.java new file mode 100644 index 0000000000000..36c4a9a85b94f --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ForecastPropertiesConfidenceLevelsItem.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; + +/** The ForecastPropertiesConfidenceLevelsItem model. */ +@Fluent +public final class ForecastPropertiesConfidenceLevelsItem { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ForecastPropertiesConfidenceLevelsItem.class); + + /* + * The percentage level of the confidence + */ + @JsonProperty(value = "percentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal percentage; + + /* + * The boundary of the percentage, values could be 'Upper' or 'Lower' + */ + @JsonProperty(value = "bound") + private Bound bound; + + /* + * The amount of forecast within the percentage level + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal value; + + /** + * Get the percentage property: The percentage level of the confidence. + * + * @return the percentage value. + */ + public BigDecimal percentage() { + return this.percentage; + } + + /** + * Get the bound property: The boundary of the percentage, values could be 'Upper' or 'Lower'. + * + * @return the bound value. + */ + public Bound bound() { + return this.bound; + } + + /** + * Set the bound property: The boundary of the percentage, values could be 'Upper' or 'Lower'. + * + * @param bound the bound value to set. + * @return the ForecastPropertiesConfidenceLevelsItem object itself. + */ + public ForecastPropertiesConfidenceLevelsItem withBound(Bound bound) { + this.bound = bound; + return this; + } + + /** + * Get the value property: The amount of forecast within the percentage level. + * + * @return the value value. + */ + public BigDecimal value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Forecasts.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Forecasts.java new file mode 100644 index 0000000000000..51cfaeb0c67a9 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Forecasts.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Forecasts. */ +public interface Forecasts { + /** + * Lists the forecast charges by subscriptionId. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing forecasts. + */ + PagedIterable list(); + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or + * properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + * 'ne', 'or', or 'not'. + * @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 result of listing forecasts. + */ + PagedIterable list(String filter, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ForecastsListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ForecastsListResult.java new file mode 100644 index 0000000000000..af17355f5b8a8 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ForecastsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ForecastInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing forecasts. It contains a list of available forecasts. */ +@Immutable +public final class ForecastsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ForecastsListResult.class); + + /* + * The list of forecasts. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of forecasts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Grain.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Grain.java new file mode 100644 index 0000000000000..83f37ee8db4eb --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Grain.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Grain. */ +public final class Grain extends ExpandableStringEnum { + /** Static value Daily for Grain. */ + public static final Grain DAILY = fromString("Daily"); + + /** Static value Monthly for Grain. */ + public static final Grain MONTHLY = fromString("Monthly"); + + /** Static value Yearly for Grain. */ + public static final Grain YEARLY = fromString("Yearly"); + + /** + * Creates or finds a Grain from its string representation. + * + * @param name a name to look for. + * @return the corresponding Grain. + */ + @JsonCreator + public static Grain fromString(String name) { + return fromString(name, Grain.class); + } + + /** @return known Grain values. */ + public static Collection values() { + return values(Grain.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyChargeSummary.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyChargeSummary.java new file mode 100644 index 0000000000000..54135595e987a --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyChargeSummary.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.math.BigDecimal; + +/** Legacy charge summary. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("legacy") +@JsonFlatten +@Immutable +public class LegacyChargeSummary extends ChargeSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LegacyChargeSummary.class); + + /* + * The id of the billing period resource that the charge belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /* + * Usage start date. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private String usageStart; + + /* + * Usage end date. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private String usageEnd; + + /* + * Azure Charges. + */ + @JsonProperty(value = "properties.azureCharges", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal azureCharges; + + /* + * Charges Billed separately. + */ + @JsonProperty(value = "properties.chargesBilledSeparately", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal chargesBilledSeparately; + + /* + * Marketplace Charges. + */ + @JsonProperty(value = "properties.marketplaceCharges", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal marketplaceCharges; + + /* + * Currency Code + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Get the billingPeriodId property: The id of the billing period resource that the charge belongs to. + * + * @return the billingPeriodId value. + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get the usageStart property: Usage start date. + * + * @return the usageStart value. + */ + public String usageStart() { + return this.usageStart; + } + + /** + * Get the usageEnd property: Usage end date. + * + * @return the usageEnd value. + */ + public String usageEnd() { + return this.usageEnd; + } + + /** + * Get the azureCharges property: Azure Charges. + * + * @return the azureCharges value. + */ + public BigDecimal azureCharges() { + return this.azureCharges; + } + + /** + * Get the chargesBilledSeparately property: Charges Billed separately. + * + * @return the chargesBilledSeparately value. + */ + public BigDecimal chargesBilledSeparately() { + return this.chargesBilledSeparately; + } + + /** + * Get the marketplaceCharges property: Marketplace Charges. + * + * @return the marketplaceCharges value. + */ + public BigDecimal marketplaceCharges() { + return this.marketplaceCharges; + } + + /** + * Get the currency property: Currency Code. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyReservationRecommendation.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyReservationRecommendation.java new file mode 100644 index 0000000000000..8b33dcf407d82 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyReservationRecommendation.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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; + +/** Legacy reservation recommendation. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("legacy") +@JsonFlatten +@Immutable +public class LegacyReservationRecommendation extends ReservationRecommendationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LegacyReservationRecommendation.class); + + /* + * The number of days of usage to look back for recommendation. + */ + @JsonProperty(value = "properties.lookBackPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String lookBackPeriod; + + /* + * The instance Flexibility Ratio. + */ + @JsonProperty(value = "properties.instanceFlexibilityRatio", access = JsonProperty.Access.WRITE_ONLY) + private Float instanceFlexibilityRatio; + + /* + * The instance Flexibility Group. + */ + @JsonProperty(value = "properties.instanceFlexibilityGroup", access = JsonProperty.Access.WRITE_ONLY) + private String instanceFlexibilityGroup; + + /* + * The normalized Size. + */ + @JsonProperty(value = "properties.normalizedSize", access = JsonProperty.Access.WRITE_ONLY) + private String normalizedSize; + + /* + * The recommended Quantity Normalized. + */ + @JsonProperty(value = "properties.recommendedQuantityNormalized", access = JsonProperty.Access.WRITE_ONLY) + private Float recommendedQuantityNormalized; + + /* + * The meter id (GUID) + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /* + * RI recommendations in one or three year terms. + */ + @JsonProperty(value = "properties.term", access = JsonProperty.Access.WRITE_ONLY) + private String term; + + /* + * The total amount of cost without reserved instances. + */ + @JsonProperty(value = "properties.costWithNoReservedInstances", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal costWithNoReservedInstances; + + /* + * Recommended quality for reserved instances. + */ + @JsonProperty(value = "properties.recommendedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal recommendedQuantity; + + /* + * The total amount of cost with reserved instances. + */ + @JsonProperty(value = "properties.totalCostWithReservedInstances", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalCostWithReservedInstances; + + /* + * Total estimated savings with reserved instances. + */ + @JsonProperty(value = "properties.netSavings", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal netSavings; + + /* + * The usage date for looking back. + */ + @JsonProperty(value = "properties.firstUsageDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime firstUsageDate; + + /* + * Shared or single recommendation. + */ + @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /* + * List of sku properties + */ + @JsonProperty(value = "properties.skuProperties", access = JsonProperty.Access.WRITE_ONLY) + private List skuProperties; + + /** + * Get the lookBackPeriod property: The number of days of usage to look back for recommendation. + * + * @return the lookBackPeriod value. + */ + public String lookBackPeriod() { + return this.lookBackPeriod; + } + + /** + * Get the instanceFlexibilityRatio property: The instance Flexibility Ratio. + * + * @return the instanceFlexibilityRatio value. + */ + public Float instanceFlexibilityRatio() { + return this.instanceFlexibilityRatio; + } + + /** + * Get the instanceFlexibilityGroup property: The instance Flexibility Group. + * + * @return the instanceFlexibilityGroup value. + */ + public String instanceFlexibilityGroup() { + return this.instanceFlexibilityGroup; + } + + /** + * Get the normalizedSize property: The normalized Size. + * + * @return the normalizedSize value. + */ + public String normalizedSize() { + return this.normalizedSize; + } + + /** + * Get the recommendedQuantityNormalized property: The recommended Quantity Normalized. + * + * @return the recommendedQuantityNormalized value. + */ + public Float recommendedQuantityNormalized() { + return this.recommendedQuantityNormalized; + } + + /** + * Get the meterId property: The meter id (GUID). + * + * @return the meterId value. + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get the term property: RI recommendations in one or three year terms. + * + * @return the term value. + */ + public String term() { + return this.term; + } + + /** + * Get the costWithNoReservedInstances property: The total amount of cost without reserved instances. + * + * @return the costWithNoReservedInstances value. + */ + public BigDecimal costWithNoReservedInstances() { + return this.costWithNoReservedInstances; + } + + /** + * Get the recommendedQuantity property: Recommended quality for reserved instances. + * + * @return the recommendedQuantity value. + */ + public BigDecimal recommendedQuantity() { + return this.recommendedQuantity; + } + + /** + * Get the totalCostWithReservedInstances property: The total amount of cost with reserved instances. + * + * @return the totalCostWithReservedInstances value. + */ + public BigDecimal totalCostWithReservedInstances() { + return this.totalCostWithReservedInstances; + } + + /** + * Get the netSavings property: Total estimated savings with reserved instances. + * + * @return the netSavings value. + */ + public BigDecimal netSavings() { + return this.netSavings; + } + + /** + * Get the firstUsageDate property: The usage date for looking back. + * + * @return the firstUsageDate value. + */ + public OffsetDateTime firstUsageDate() { + return this.firstUsageDate; + } + + /** + * Get the scope property: Shared or single recommendation. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Get the skuProperties property: List of sku properties. + * + * @return the skuProperties value. + */ + public List skuProperties() { + return this.skuProperties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (skuProperties() != null) { + skuProperties().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyReservationTransaction.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyReservationTransaction.java new file mode 100644 index 0000000000000..e9ebfb4c40a41 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyReservationTransaction.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ReservationTransactionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Legacy Reservation transaction resource. */ +@Immutable +public final class LegacyReservationTransaction extends ReservationTransactionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LegacyReservationTransaction.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyUsageDetail.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyUsageDetail.java new file mode 100644 index 0000000000000..ebddba41eaa88 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LegacyUsageDetail.java @@ -0,0 +1,703 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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.UUID; + +/** Legacy usage detail. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("legacy") +@JsonFlatten +@Immutable +public class LegacyUsageDetail extends UsageDetailInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LegacyUsageDetail.class); + + /* + * Billing Account identifier. + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /* + * Billing Account Name. + */ + @JsonProperty(value = "properties.billingAccountName", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountName; + + /* + * The billing period start date. + */ + @JsonProperty(value = "properties.billingPeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime billingPeriodStartDate; + + /* + * The billing period end date. + */ + @JsonProperty(value = "properties.billingPeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime billingPeriodEndDate; + + /* + * Billing Profile identifier. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * Billing Profile Name. + */ + @JsonProperty(value = "properties.billingProfileName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileName; + + /* + * Account Owner Id. + */ + @JsonProperty(value = "properties.accountOwnerId", access = JsonProperty.Access.WRITE_ONLY) + private String accountOwnerId; + + /* + * Account Name. + */ + @JsonProperty(value = "properties.accountName", access = JsonProperty.Access.WRITE_ONLY) + private String accountName; + + /* + * Subscription guid. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /* + * Subscription name. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /* + * Date for the usage record. + */ + @JsonProperty(value = "properties.date", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime date; + + /* + * Product name for the consumed service or purchase. Not available for + * Marketplace. + */ + @JsonProperty(value = "properties.product", access = JsonProperty.Access.WRITE_ONLY) + private String product; + + /* + * Part Number of the service used. Can be used to join with the price + * sheet. Not available for marketplace. + */ + @JsonProperty(value = "properties.partNumber", access = JsonProperty.Access.WRITE_ONLY) + private String partNumber; + + /* + * The meter id (GUID). Not available for marketplace. For reserved + * instance this represents the primary meter for which the reservation was + * purchased. For the actual VM Size for which the reservation is purchased + * see productOrderName. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /* + * The details about the meter. By default this is not populated, unless + * it's specified in $expand. + */ + @JsonProperty(value = "properties.meterDetails", access = JsonProperty.Access.WRITE_ONLY) + private MeterDetailsResponse meterDetails; + + /* + * The usage quantity. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal quantity; + + /* + * Effective Price that's charged for the usage. + */ + @JsonProperty(value = "properties.effectivePrice", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal effectivePrice; + + /* + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.cost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal cost; + + /* + * Unit Price is the price applicable to you. (your EA or other contract + * price). + */ + @JsonProperty(value = "properties.unitPrice", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal unitPrice; + + /* + * Billing Currency. + */ + @JsonProperty(value = "properties.billingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private String billingCurrency; + + /* + * Resource Location. + */ + @JsonProperty(value = "properties.resourceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String resourceLocation; + + /* + * Consumed service name. Name of the azure resource provider that emits + * the usage or was purchased. This value is not provided for marketplace + * usage. + */ + @JsonProperty(value = "properties.consumedService", access = JsonProperty.Access.WRITE_ONLY) + private String consumedService; + + /* + * Azure resource manager resource identifier. + */ + @JsonProperty(value = "properties.resourceId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceId; + + /* + * Resource Name. + */ + @JsonProperty(value = "properties.resourceName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceName; + + /* + * Service Info 1. + */ + @JsonProperty(value = "properties.serviceInfo1", access = JsonProperty.Access.WRITE_ONLY) + private String serviceInfo1; + + /* + * Service Info 2. + */ + @JsonProperty(value = "properties.serviceInfo2", access = JsonProperty.Access.WRITE_ONLY) + private String serviceInfo2; + + /* + * Additional details of this usage item. By default this is not populated, + * unless it's specified in $expand. Use this field to get usage line item + * specific details such as the actual VM Size (ServiceType) or the ratio + * in which the reservation discount is applied. + */ + @JsonProperty(value = "properties.additionalInfo", access = JsonProperty.Access.WRITE_ONLY) + private String additionalInfo; + + /* + * Invoice Section Name. + */ + @JsonProperty(value = "properties.invoiceSection", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSection; + + /* + * The cost center of this department if it is a department and a cost + * center is provided. + */ + @JsonProperty(value = "properties.costCenter", access = JsonProperty.Access.WRITE_ONLY) + private String costCenter; + + /* + * Resource Group Name. + */ + @JsonProperty(value = "properties.resourceGroup", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroup; + + /* + * ARM resource id of the reservation. Only applies to records relevant to + * reservations. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /* + * User provided display name of the reservation. Last known name for a + * particular day is populated in the daily data. Only applies to records + * relevant to reservations. + */ + @JsonProperty(value = "properties.reservationName", access = JsonProperty.Access.WRITE_ONLY) + private String reservationName; + + /* + * Product Order Id. For reservations this is the Reservation Order ID. + */ + @JsonProperty(value = "properties.productOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String productOrderId; + + /* + * Product Order Name. For reservations this is the SKU that was purchased. + */ + @JsonProperty(value = "properties.productOrderName", access = JsonProperty.Access.WRITE_ONLY) + private String productOrderName; + + /* + * Offer Id. Ex: MS-AZR-0017P, MS-AZR-0148P. + */ + @JsonProperty(value = "properties.offerId", access = JsonProperty.Access.WRITE_ONLY) + private String offerId; + + /* + * Is Azure Credit Eligible. + */ + @JsonProperty(value = "properties.isAzureCreditEligible", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isAzureCreditEligible; + + /* + * Term (in months). 1 month for monthly recurring purchase. 12 months for + * a 1 year reservation. 36 months for a 3 year reservation. + */ + @JsonProperty(value = "properties.term", access = JsonProperty.Access.WRITE_ONLY) + private String term; + + /* + * Publisher Name. + */ + @JsonProperty(value = "properties.publisherName", access = JsonProperty.Access.WRITE_ONLY) + private String publisherName; + + /* + * Publisher Type. + */ + @JsonProperty(value = "properties.publisherType", access = JsonProperty.Access.WRITE_ONLY) + private String publisherType; + + /* + * Plan Name. + */ + @JsonProperty(value = "properties.planName", access = JsonProperty.Access.WRITE_ONLY) + private String planName; + + /* + * Indicates a charge represents credits, usage, a Marketplace purchase, a + * reservation fee, or a refund. + */ + @JsonProperty(value = "properties.chargeType", access = JsonProperty.Access.WRITE_ONLY) + private String chargeType; + + /* + * Indicates how frequently this charge will occur. OneTime for purchases + * which only happen once, Monthly for fees which recur every month, and + * UsageBased for charges based on how much a service is used. + */ + @JsonProperty(value = "properties.frequency", access = JsonProperty.Access.WRITE_ONLY) + private String frequency; + + /** + * Get the billingAccountId property: Billing Account identifier. + * + * @return the billingAccountId value. + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * Get the billingAccountName property: Billing Account Name. + * + * @return the billingAccountName value. + */ + public String billingAccountName() { + return this.billingAccountName; + } + + /** + * Get the billingPeriodStartDate property: The billing period start date. + * + * @return the billingPeriodStartDate value. + */ + public OffsetDateTime billingPeriodStartDate() { + return this.billingPeriodStartDate; + } + + /** + * Get the billingPeriodEndDate property: The billing period end date. + * + * @return the billingPeriodEndDate value. + */ + public OffsetDateTime billingPeriodEndDate() { + return this.billingPeriodEndDate; + } + + /** + * Get the billingProfileId property: Billing Profile identifier. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileName property: Billing Profile Name. + * + * @return the billingProfileName value. + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Get the accountOwnerId property: Account Owner Id. + * + * @return the accountOwnerId value. + */ + public String accountOwnerId() { + return this.accountOwnerId; + } + + /** + * Get the accountName property: Account Name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Get the subscriptionId property: Subscription guid. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscriptionName property: Subscription name. + * + * @return the subscriptionName value. + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Get the date property: Date for the usage record. + * + * @return the date value. + */ + public OffsetDateTime date() { + return this.date; + } + + /** + * Get the product property: Product name for the consumed service or purchase. Not available for Marketplace. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Get the partNumber property: Part Number of the service used. Can be used to join with the price sheet. Not + * available for marketplace. + * + * @return the partNumber value. + */ + public String partNumber() { + return this.partNumber; + } + + /** + * Get the meterId property: The meter id (GUID). Not available for marketplace. For reserved instance this + * represents the primary meter for which the reservation was purchased. For the actual VM Size for which the + * reservation is purchased see productOrderName. + * + * @return the meterId value. + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get the meterDetails property: The details about the meter. By default this is not populated, unless it's + * specified in $expand. + * + * @return the meterDetails value. + */ + public MeterDetailsResponse meterDetails() { + return this.meterDetails; + } + + /** + * Get the quantity property: The usage quantity. + * + * @return the quantity value. + */ + public BigDecimal quantity() { + return this.quantity; + } + + /** + * Get the effectivePrice property: Effective Price that's charged for the usage. + * + * @return the effectivePrice value. + */ + public BigDecimal effectivePrice() { + return this.effectivePrice; + } + + /** + * Get the cost property: The amount of cost before tax. + * + * @return the cost value. + */ + public BigDecimal cost() { + return this.cost; + } + + /** + * Get the unitPrice property: Unit Price is the price applicable to you. (your EA or other contract price). + * + * @return the unitPrice value. + */ + public BigDecimal unitPrice() { + return this.unitPrice; + } + + /** + * Get the billingCurrency property: Billing Currency. + * + * @return the billingCurrency value. + */ + public String billingCurrency() { + return this.billingCurrency; + } + + /** + * Get the resourceLocation property: Resource Location. + * + * @return the resourceLocation value. + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Get the consumedService property: Consumed service name. Name of the azure resource provider that emits the usage + * or was purchased. This value is not provided for marketplace usage. + * + * @return the consumedService value. + */ + public String consumedService() { + return this.consumedService; + } + + /** + * Get the resourceId property: Azure resource manager resource identifier. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Get the resourceName property: Resource Name. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the serviceInfo1 property: Service Info 1. + * + * @return the serviceInfo1 value. + */ + public String serviceInfo1() { + return this.serviceInfo1; + } + + /** + * Get the serviceInfo2 property: Service Info 2. + * + * @return the serviceInfo2 value. + */ + public String serviceInfo2() { + return this.serviceInfo2; + } + + /** + * Get the additionalInfo property: Additional details of this usage item. By default this is not populated, unless + * it's specified in $expand. Use this field to get usage line item specific details such as the actual VM Size + * (ServiceType) or the ratio in which the reservation discount is applied. + * + * @return the additionalInfo value. + */ + public String additionalInfo() { + return this.additionalInfo; + } + + /** + * Get the invoiceSection property: Invoice Section Name. + * + * @return the invoiceSection value. + */ + public String invoiceSection() { + return this.invoiceSection; + } + + /** + * Get the costCenter property: The cost center of this department if it is a department and a cost center is + * provided. + * + * @return the costCenter value. + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Get the resourceGroup property: Resource Group Name. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Get the reservationId property: ARM resource id of the reservation. Only applies to records relevant to + * reservations. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get the reservationName property: User provided display name of the reservation. Last known name for a particular + * day is populated in the daily data. Only applies to records relevant to reservations. + * + * @return the reservationName value. + */ + public String reservationName() { + return this.reservationName; + } + + /** + * Get the productOrderId property: Product Order Id. For reservations this is the Reservation Order ID. + * + * @return the productOrderId value. + */ + public String productOrderId() { + return this.productOrderId; + } + + /** + * Get the productOrderName property: Product Order Name. For reservations this is the SKU that was purchased. + * + * @return the productOrderName value. + */ + public String productOrderName() { + return this.productOrderName; + } + + /** + * Get the offerId property: Offer Id. Ex: MS-AZR-0017P, MS-AZR-0148P. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Get the isAzureCreditEligible property: Is Azure Credit Eligible. + * + * @return the isAzureCreditEligible value. + */ + public Boolean isAzureCreditEligible() { + return this.isAzureCreditEligible; + } + + /** + * Get the term property: Term (in months). 1 month for monthly recurring purchase. 12 months for a 1 year + * reservation. 36 months for a 3 year reservation. + * + * @return the term value. + */ + public String term() { + return this.term; + } + + /** + * Get the publisherName property: Publisher Name. + * + * @return the publisherName value. + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Get the publisherType property: Publisher Type. + * + * @return the publisherType value. + */ + public String publisherType() { + return this.publisherType; + } + + /** + * Get the planName property: Plan Name. + * + * @return the planName value. + */ + public String planName() { + return this.planName; + } + + /** + * Get the chargeType property: Indicates a charge represents credits, usage, a Marketplace purchase, a reservation + * fee, or a refund. + * + * @return the chargeType value. + */ + public String chargeType() { + return this.chargeType; + } + + /** + * Get the frequency property: Indicates how frequently this charge will occur. OneTime for purchases which only + * happen once, Monthly for fees which recur every month, and UsageBased for charges based on how much a service is + * used. + * + * @return the frequency value. + */ + public String frequency() { + return this.frequency; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (meterDetails() != null) { + meterDetails().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LookBackPeriod.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LookBackPeriod.java new file mode 100644 index 0000000000000..3488a9665b86d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LookBackPeriod.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LookBackPeriod. */ +public final class LookBackPeriod extends ExpandableStringEnum { + /** Static value Last7Days for LookBackPeriod. */ + public static final LookBackPeriod LAST7DAYS = fromString("Last7Days"); + + /** Static value Last30Days for LookBackPeriod. */ + public static final LookBackPeriod LAST30DAYS = fromString("Last30Days"); + + /** Static value Last60Days for LookBackPeriod. */ + public static final LookBackPeriod LAST60DAYS = fromString("Last60Days"); + + /** + * Creates or finds a LookBackPeriod from its string representation. + * + * @param name a name to look for. + * @return the corresponding LookBackPeriod. + */ + @JsonCreator + public static LookBackPeriod fromString(String name) { + return fromString(name, LookBackPeriod.class); + } + + /** @return known LookBackPeriod values. */ + public static Collection values() { + return values(LookBackPeriod.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotSource.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotSource.java new file mode 100644 index 0000000000000..5ad1d4f4dc751 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotSource.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LotSource. */ +public final class LotSource extends ExpandableStringEnum { + /** Static value PurchasedCredit for LotSource. */ + public static final LotSource PURCHASED_CREDIT = fromString("PurchasedCredit"); + + /** Static value PromotionalCredit for LotSource. */ + public static final LotSource PROMOTIONAL_CREDIT = fromString("PromotionalCredit"); + + /** + * Creates or finds a LotSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding LotSource. + */ + @JsonCreator + public static LotSource fromString(String name) { + return fromString(name, LotSource.class); + } + + /** @return known LotSource values. */ + public static Collection values() { + return values(LotSource.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotSummary.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotSummary.java new file mode 100644 index 0000000000000..0a0a6c18e31cf --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotSummary.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.LotSummaryInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of LotSummary. */ +public interface LotSummary { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the originalAmount property: Original amount. + * + * @return the originalAmount value. + */ + Amount originalAmount(); + + /** + * Gets the closedBalance property: Closed balance. + * + * @return the closedBalance value. + */ + Amount closedBalance(); + + /** + * Gets the source property: Lot source. + * + * @return the source value. + */ + LotSource source(); + + /** + * Gets the startDate property: Start date. + * + * @return the startDate value. + */ + OffsetDateTime startDate(); + + /** + * Gets the expirationDate property: Expiration date. + * + * @return the expirationDate value. + */ + OffsetDateTime expirationDate(); + + /** + * Gets the poNumber property: PO number. + * + * @return the poNumber value. + */ + String poNumber(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.LotSummaryInner object. + * + * @return the inner object. + */ + LotSummaryInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Lots.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Lots.java new file mode 100644 index 0000000000000..580dabac15b66 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Lots.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.LotSummaryInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing lot summary. */ +@Immutable +public final class Lots { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Lots.class); + + /* + * The list of lot summary. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of lot summary. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotsOperations.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotsOperations.java new file mode 100644 index 0000000000000..4f5f68a511f9b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/LotsOperations.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LotsOperations. */ +public interface LotsOperations { + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing lot summary. + */ + PagedIterable list(String billingAccountId, String billingProfileId); + + /** + * Lists the lots by billingAccountId and billingProfileId. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @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 result of listing lot summary. + */ + PagedIterable list(String billingAccountId, String billingProfileId, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ManagementGroupAggregatedCostResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ManagementGroupAggregatedCostResult.java new file mode 100644 index 0000000000000..acaf6e0ad9fa8 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ManagementGroupAggregatedCostResult.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ManagementGroupAggregatedCostResultInner; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ManagementGroupAggregatedCostResult. */ +public interface ManagementGroupAggregatedCostResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the billingPeriodId property: The id of the billing period resource that the aggregated cost belongs to. + * + * @return the billingPeriodId value. + */ + String billingPeriodId(); + + /** + * Gets the usageStart property: The start of the date time range covered by aggregated cost. + * + * @return the usageStart value. + */ + OffsetDateTime usageStart(); + + /** + * Gets the usageEnd property: The end of the date time range covered by the aggregated cost. + * + * @return the usageEnd value. + */ + OffsetDateTime usageEnd(); + + /** + * Gets the azureCharges property: Azure Charges. + * + * @return the azureCharges value. + */ + BigDecimal azureCharges(); + + /** + * Gets the marketplaceCharges property: Marketplace Charges. + * + * @return the marketplaceCharges value. + */ + BigDecimal marketplaceCharges(); + + /** + * Gets the chargesBilledSeparately property: Charges Billed Separately. + * + * @return the chargesBilledSeparately value. + */ + BigDecimal chargesBilledSeparately(); + + /** + * Gets the currency property: The ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value. + */ + String currency(); + + /** + * Gets the children property: Children of a management group. + * + * @return the children value. + */ + List children(); + + /** + * Gets the includedSubscriptions property: List of subscription Guids included in the calculation of aggregated + * cost. + * + * @return the includedSubscriptions value. + */ + List includedSubscriptions(); + + /** + * Gets the excludedSubscriptions property: List of subscription Guids excluded from the calculation of aggregated + * cost. + * + * @return the excludedSubscriptions value. + */ + List excludedSubscriptions(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ManagementGroupAggregatedCostResultInner + * object. + * + * @return the inner object. + */ + ManagementGroupAggregatedCostResultInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Marketplace.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Marketplace.java new file mode 100644 index 0000000000000..735a86748f42f --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Marketplace.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.MarketplaceInner; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** An immutable client-side representation of Marketplace. */ +public interface Marketplace { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the billingPeriodId property: The id of the billing period resource that the usage belongs to. + * + * @return the billingPeriodId value. + */ + String billingPeriodId(); + + /** + * Gets the usageStart property: The start of the date time range covered by the usage detail. + * + * @return the usageStart value. + */ + OffsetDateTime usageStart(); + + /** + * Gets the usageEnd property: The end of the date time range covered by the usage detail. + * + * @return the usageEnd value. + */ + OffsetDateTime usageEnd(); + + /** + * Gets the resourceRate property: The marketplace resource rate. + * + * @return the resourceRate value. + */ + BigDecimal resourceRate(); + + /** + * Gets the offerName property: The type of offer. + * + * @return the offerName value. + */ + String offerName(); + + /** + * Gets the resourceGroup property: The name of resource group. + * + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * Gets the orderNumber property: The order number. + * + * @return the orderNumber value. + */ + String orderNumber(); + + /** + * Gets the instanceName property: The name of the resource instance that the usage is about. + * + * @return the instanceName value. + */ + String instanceName(); + + /** + * Gets the instanceId property: The uri of the resource instance that the usage is about. + * + * @return the instanceId value. + */ + String instanceId(); + + /** + * Gets the currency property: The ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value. + */ + String currency(); + + /** + * Gets the consumedQuantity property: The quantity of usage. + * + * @return the consumedQuantity value. + */ + BigDecimal consumedQuantity(); + + /** + * Gets the unitOfMeasure property: The unit of measure. + * + * @return the unitOfMeasure value. + */ + String unitOfMeasure(); + + /** + * Gets the pretaxCost property: The amount of cost before tax. + * + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * Gets the isEstimated property: The estimated usage is subject to change. + * + * @return the isEstimated value. + */ + Boolean isEstimated(); + + /** + * Gets the meterId property: The meter id (GUID). + * + * @return the meterId value. + */ + UUID meterId(); + + /** + * Gets the subscriptionGuid property: Subscription guid. + * + * @return the subscriptionGuid value. + */ + UUID subscriptionGuid(); + + /** + * Gets the subscriptionName property: Subscription name. + * + * @return the subscriptionName value. + */ + String subscriptionName(); + + /** + * Gets the accountName property: Account name. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the departmentName property: Department name. + * + * @return the departmentName value. + */ + String departmentName(); + + /** + * Gets the consumedService property: Consumed service name. + * + * @return the consumedService value. + */ + String consumedService(); + + /** + * Gets the costCenter property: The cost center of this department if it is a department and a costcenter exists. + * + * @return the costCenter value. + */ + String costCenter(); + + /** + * Gets the additionalProperties property: Additional details of this usage item. By default this is not populated, + * unless it's specified in $expand. + * + * @return the additionalProperties value. + */ + String additionalProperties(); + + /** + * Gets the publisherName property: The name of publisher. + * + * @return the publisherName value. + */ + String publisherName(); + + /** + * Gets the planName property: The name of plan. + * + * @return the planName value. + */ + String planName(); + + /** + * Gets the isRecurringCharge property: Flag indicating whether this is a recurring charge or not. + * + * @return the isRecurringCharge value. + */ + Boolean isRecurringCharge(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.MarketplaceInner object. + * + * @return the inner object. + */ + MarketplaceInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Marketplaces.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Marketplaces.java new file mode 100644 index 0000000000000..82433cf0f8663 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Marketplaces.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Marketplaces. */ +public interface Marketplaces { + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing marketplaces. + */ + PagedIterable list(String scope); + + /** + * Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, + * 2014 or later. + * + * @param scope The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc + * time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', + * 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param 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 result of listing marketplaces. + */ + PagedIterable list(String scope, String filter, Integer top, String skiptoken, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MarketplacesListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MarketplacesListResult.java new file mode 100644 index 0000000000000..2743240b9f0b7 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MarketplacesListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.MarketplaceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of listing marketplaces. It contains a list of available marketplaces in reverse chronological order by + * billing period. + */ +@Immutable +public final class MarketplacesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplacesListResult.class); + + /* + * The list of marketplaces. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of marketplaces. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MeterDetails.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MeterDetails.java new file mode 100644 index 0000000000000..26cbeec938a64 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MeterDetails.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; + +/** The properties of the meter detail. */ +@Immutable +public final class MeterDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MeterDetails.class); + + /* + * The name of the meter, within the given meter category + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /* + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /* + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /* + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /* + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /* + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /* + * The name of the service. + */ + @JsonProperty(value = "serviceName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceName; + + /* + * The service tier. + */ + @JsonProperty(value = "serviceTier", access = JsonProperty.Access.WRITE_ONLY) + private String serviceTier; + + /** + * Get the meterName property: The name of the meter, within the given meter category. + * + * @return the meterName value. + */ + public String meterName() { + return this.meterName; + } + + /** + * Get the meterCategory property: The category of the meter, for example, 'Cloud services', 'Networking', etc.. + * + * @return the meterCategory value. + */ + public String meterCategory() { + return this.meterCategory; + } + + /** + * Get the meterSubCategory property: The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute + * (IXP)', etc.. + * + * @return the meterSubCategory value. + */ + public String meterSubCategory() { + return this.meterSubCategory; + } + + /** + * Get the unit property: The unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the meterLocation property: The location in which the Azure service is available. + * + * @return the meterLocation value. + */ + public String meterLocation() { + return this.meterLocation; + } + + /** + * Get the totalIncludedQuantity property: The total included quantity associated with the offer. + * + * @return the totalIncludedQuantity value. + */ + public BigDecimal totalIncludedQuantity() { + return this.totalIncludedQuantity; + } + + /** + * Get the pretaxStandardRate property: The pretax listing price. + * + * @return the pretaxStandardRate value. + */ + public BigDecimal pretaxStandardRate() { + return this.pretaxStandardRate; + } + + /** + * Get the serviceName property: The name of the service. + * + * @return the serviceName value. + */ + public String serviceName() { + return this.serviceName; + } + + /** + * Get the serviceTier property: The service tier. + * + * @return the serviceTier value. + */ + public String serviceTier() { + return this.serviceTier; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MeterDetailsResponse.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MeterDetailsResponse.java new file mode 100644 index 0000000000000..9a2fd82709ffb --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/MeterDetailsResponse.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the meter detail. */ +@Immutable +public final class MeterDetailsResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MeterDetailsResponse.class); + + /* + * The name of the meter, within the given meter category + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /* + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /* + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /* + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /* + * The service family. + */ + @JsonProperty(value = "serviceFamily", access = JsonProperty.Access.WRITE_ONLY) + private String serviceFamily; + + /** + * Get the meterName property: The name of the meter, within the given meter category. + * + * @return the meterName value. + */ + public String meterName() { + return this.meterName; + } + + /** + * Get the meterCategory property: The category of the meter, for example, 'Cloud services', 'Networking', etc.. + * + * @return the meterCategory value. + */ + public String meterCategory() { + return this.meterCategory; + } + + /** + * Get the meterSubCategory property: The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute + * (IXP)', etc.. + * + * @return the meterSubCategory value. + */ + public String meterSubCategory() { + return this.meterSubCategory; + } + + /** + * Get the unitOfMeasure property: The unit in which the meter consumption is charged, for example, 'Hours', 'GB', + * etc. + * + * @return the unitOfMeasure value. + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get the serviceFamily property: The service family. + * + * @return the serviceFamily value. + */ + public String serviceFamily() { + return this.serviceFamily; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Metrictype.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Metrictype.java new file mode 100644 index 0000000000000..1d6e46c7ce5d1 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Metrictype.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Metrictype. */ +public final class Metrictype extends ExpandableStringEnum { + /** Static value actualcost for Metrictype. */ + public static final Metrictype ACTUALCOST = fromString("actualcost"); + + /** Static value amortizedcost for Metrictype. */ + public static final Metrictype AMORTIZEDCOST = fromString("amortizedcost"); + + /** Static value usage for Metrictype. */ + public static final Metrictype USAGE = fromString("usage"); + + /** + * Creates or finds a Metrictype from its string representation. + * + * @param name a name to look for. + * @return the corresponding Metrictype. + */ + @JsonCreator + public static Metrictype fromString(String name) { + return fromString(name, Metrictype.class); + } + + /** @return known Metrictype values. */ + public static Collection values() { + return values(Metrictype.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernChargeSummary.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernChargeSummary.java new file mode 100644 index 0000000000000..cd0b9a98a62c7 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernChargeSummary.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Modern charge summary. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("modern") +@JsonFlatten +@Immutable +public class ModernChargeSummary extends ChargeSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ModernChargeSummary.class); + + /* + * The id of the billing period resource that the charge belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /* + * Usage start date. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private String usageStart; + + /* + * Usage end date. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private String usageEnd; + + /* + * Azure Charges. + */ + @JsonProperty(value = "properties.azureCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount azureCharges; + + /* + * Charges Billed separately. + */ + @JsonProperty(value = "properties.chargesBilledSeparately", access = JsonProperty.Access.WRITE_ONLY) + private Amount chargesBilledSeparately; + + /* + * Marketplace Charges. + */ + @JsonProperty(value = "properties.marketplaceCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount marketplaceCharges; + + /* + * Billing Account Id + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /* + * Billing Profile Id + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * Invoice Section Id + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /* + * Customer Id + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /* + * Is charge Invoiced + */ + @JsonProperty(value = "properties.isInvoiced", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isInvoiced; + + /** + * Get the billingPeriodId property: The id of the billing period resource that the charge belongs to. + * + * @return the billingPeriodId value. + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get the usageStart property: Usage start date. + * + * @return the usageStart value. + */ + public String usageStart() { + return this.usageStart; + } + + /** + * Get the usageEnd property: Usage end date. + * + * @return the usageEnd value. + */ + public String usageEnd() { + return this.usageEnd; + } + + /** + * Get the azureCharges property: Azure Charges. + * + * @return the azureCharges value. + */ + public Amount azureCharges() { + return this.azureCharges; + } + + /** + * Get the chargesBilledSeparately property: Charges Billed separately. + * + * @return the chargesBilledSeparately value. + */ + public Amount chargesBilledSeparately() { + return this.chargesBilledSeparately; + } + + /** + * Get the marketplaceCharges property: Marketplace Charges. + * + * @return the marketplaceCharges value. + */ + public Amount marketplaceCharges() { + return this.marketplaceCharges; + } + + /** + * Get the billingAccountId property: Billing Account Id. + * + * @return the billingAccountId value. + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * Get the billingProfileId property: Billing Profile Id. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the invoiceSectionId property: Invoice Section Id. + * + * @return the invoiceSectionId value. + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the customerId property: Customer Id. + * + * @return the customerId value. + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the isInvoiced property: Is charge Invoiced. + * + * @return the isInvoiced value. + */ + public Boolean isInvoiced() { + return this.isInvoiced; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (azureCharges() != null) { + azureCharges().validate(); + } + if (chargesBilledSeparately() != null) { + chargesBilledSeparately().validate(); + } + if (marketplaceCharges() != null) { + marketplaceCharges().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationRecommendation.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationRecommendation.java new file mode 100644 index 0000000000000..6acd6f97752aa --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationRecommendation.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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; + +/** Modern reservation recommendation. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("modern") +@JsonFlatten +@Immutable +public class ModernReservationRecommendation extends ReservationRecommendationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ModernReservationRecommendation.class); + + /* + * The number of days of usage to look back for recommendation. + */ + @JsonProperty(value = "properties.lookBackPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String lookBackPeriod; + + /* + * The instance Flexibility Ratio. + */ + @JsonProperty(value = "properties.instanceFlexibilityRatio", access = JsonProperty.Access.WRITE_ONLY) + private Float instanceFlexibilityRatio; + + /* + * The instance Flexibility Group. + */ + @JsonProperty(value = "properties.instanceFlexibilityGroup", access = JsonProperty.Access.WRITE_ONLY) + private String instanceFlexibilityGroup; + + /* + * The normalized Size. + */ + @JsonProperty(value = "properties.normalizedSize", access = JsonProperty.Access.WRITE_ONLY) + private String normalizedSize; + + /* + * The recommended Quantity Normalized. + */ + @JsonProperty(value = "properties.recommendedQuantityNormalized", access = JsonProperty.Access.WRITE_ONLY) + private Float recommendedQuantityNormalized; + + /* + * The meter id (GUID) + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /* + * RI recommendations in one or three year terms. + */ + @JsonProperty(value = "properties.term", access = JsonProperty.Access.WRITE_ONLY) + private String term; + + /* + * The total amount of cost without reserved instances. + */ + @JsonProperty(value = "properties.costWithNoReservedInstances", access = JsonProperty.Access.WRITE_ONLY) + private Amount costWithNoReservedInstances; + + /* + * Recommended quality for reserved instances. + */ + @JsonProperty(value = "properties.recommendedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal recommendedQuantity; + + /* + * The total amount of cost with reserved instances. + */ + @JsonProperty(value = "properties.totalCostWithReservedInstances", access = JsonProperty.Access.WRITE_ONLY) + private Amount totalCostWithReservedInstances; + + /* + * Total estimated savings with reserved instances. + */ + @JsonProperty(value = "properties.netSavings", access = JsonProperty.Access.WRITE_ONLY) + private Amount netSavings; + + /* + * The usage date for looking back. + */ + @JsonProperty(value = "properties.firstUsageDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime firstUsageDate; + + /* + * Shared or single recommendation. + */ + @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /* + * List of sku properties + */ + @JsonProperty(value = "properties.skuProperties", access = JsonProperty.Access.WRITE_ONLY) + private List skuProperties; + + /** + * Get the lookBackPeriod property: The number of days of usage to look back for recommendation. + * + * @return the lookBackPeriod value. + */ + public String lookBackPeriod() { + return this.lookBackPeriod; + } + + /** + * Get the instanceFlexibilityRatio property: The instance Flexibility Ratio. + * + * @return the instanceFlexibilityRatio value. + */ + public Float instanceFlexibilityRatio() { + return this.instanceFlexibilityRatio; + } + + /** + * Get the instanceFlexibilityGroup property: The instance Flexibility Group. + * + * @return the instanceFlexibilityGroup value. + */ + public String instanceFlexibilityGroup() { + return this.instanceFlexibilityGroup; + } + + /** + * Get the normalizedSize property: The normalized Size. + * + * @return the normalizedSize value. + */ + public String normalizedSize() { + return this.normalizedSize; + } + + /** + * Get the recommendedQuantityNormalized property: The recommended Quantity Normalized. + * + * @return the recommendedQuantityNormalized value. + */ + public Float recommendedQuantityNormalized() { + return this.recommendedQuantityNormalized; + } + + /** + * Get the meterId property: The meter id (GUID). + * + * @return the meterId value. + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get the term property: RI recommendations in one or three year terms. + * + * @return the term value. + */ + public String term() { + return this.term; + } + + /** + * Get the costWithNoReservedInstances property: The total amount of cost without reserved instances. + * + * @return the costWithNoReservedInstances value. + */ + public Amount costWithNoReservedInstances() { + return this.costWithNoReservedInstances; + } + + /** + * Get the recommendedQuantity property: Recommended quality for reserved instances. + * + * @return the recommendedQuantity value. + */ + public BigDecimal recommendedQuantity() { + return this.recommendedQuantity; + } + + /** + * Get the totalCostWithReservedInstances property: The total amount of cost with reserved instances. + * + * @return the totalCostWithReservedInstances value. + */ + public Amount totalCostWithReservedInstances() { + return this.totalCostWithReservedInstances; + } + + /** + * Get the netSavings property: Total estimated savings with reserved instances. + * + * @return the netSavings value. + */ + public Amount netSavings() { + return this.netSavings; + } + + /** + * Get the firstUsageDate property: The usage date for looking back. + * + * @return the firstUsageDate value. + */ + public OffsetDateTime firstUsageDate() { + return this.firstUsageDate; + } + + /** + * Get the scope property: Shared or single recommendation. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Get the skuProperties property: List of sku properties. + * + * @return the skuProperties value. + */ + public List skuProperties() { + return this.skuProperties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (costWithNoReservedInstances() != null) { + costWithNoReservedInstances().validate(); + } + if (totalCostWithReservedInstances() != null) { + totalCostWithReservedInstances().validate(); + } + if (netSavings() != null) { + netSavings().validate(); + } + if (skuProperties() != null) { + skuProperties().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationTransaction.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationTransaction.java new file mode 100644 index 0000000000000..47a4683b58478 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationTransaction.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ModernReservationTransactionInner; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ModernReservationTransaction. */ +public interface ModernReservationTransaction { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + List tags(); + + /** + * Gets the amount property: The charge of the transaction. + * + * @return the amount value. + */ + BigDecimal amount(); + + /** + * Gets the armSkuName property: This is the ARM Sku name. It can be used to join with the serviceType field in + * additional info in usage records. + * + * @return the armSkuName value. + */ + String armSkuName(); + + /** + * Gets the billingFrequency property: The billing frequency, which can be either one-time or recurring. + * + * @return the billingFrequency value. + */ + String billingFrequency(); + + /** + * Gets the billingProfileId property: Billing profile Id. + * + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * Gets the billingProfileName property: Billing profile name. + * + * @return the billingProfileName value. + */ + String billingProfileName(); + + /** + * Gets the currency property: The ISO currency in which the transaction is charged, for example, USD. + * + * @return the currency value. + */ + String currency(); + + /** + * Gets the description property: The description of the transaction. + * + * @return the description value. + */ + String description(); + + /** + * Gets the eventDate property: The date of the transaction. + * + * @return the eventDate value. + */ + OffsetDateTime eventDate(); + + /** + * Gets the eventType property: The type of the transaction (Purchase, Cancel, etc.). + * + * @return the eventType value. + */ + String eventType(); + + /** + * Gets the invoice property: Invoice Number. + * + * @return the invoice value. + */ + String invoice(); + + /** + * Gets the invoiceId property: Invoice Id as on the invoice where the specific transaction appears. + * + * @return the invoiceId value. + */ + String invoiceId(); + + /** + * Gets the invoiceSectionId property: Invoice Section Id. + * + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * Gets the invoiceSectionName property: Invoice Section Name. + * + * @return the invoiceSectionName value. + */ + String invoiceSectionName(); + + /** + * Gets the purchasingSubscriptionGuid property: The subscription guid that makes the transaction. + * + * @return the purchasingSubscriptionGuid value. + */ + UUID purchasingSubscriptionGuid(); + + /** + * Gets the purchasingSubscriptionName property: The subscription name that makes the transaction. + * + * @return the purchasingSubscriptionName value. + */ + String purchasingSubscriptionName(); + + /** + * Gets the quantity property: The quantity of the transaction. + * + * @return the quantity value. + */ + BigDecimal quantity(); + + /** + * Gets the region property: The region of the transaction. + * + * @return the region value. + */ + String region(); + + /** + * Gets the reservationOrderId property: The reservation order ID is the identifier for a reservation purchase. Each + * reservation order ID represents a single purchase transaction. A reservation order contains reservations. The + * reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * Gets the reservationOrderName property: The name of the reservation order. + * + * @return the reservationOrderName value. + */ + String reservationOrderName(); + + /** + * Gets the term property: This is the term of the transaction. + * + * @return the term value. + */ + String term(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ModernReservationTransactionInner object. + * + * @return the inner object. + */ + ModernReservationTransactionInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationTransactionsListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationTransactionsListResult.java new file mode 100644 index 0000000000000..77b4c8422ecb4 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernReservationTransactionsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ModernReservationTransactionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing reservation recommendations. */ +@Immutable +public final class ModernReservationTransactionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ModernReservationTransactionsListResult.class); + + /* + * The list of reservation recommendations. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of reservation recommendations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernUsageDetail.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernUsageDetail.java new file mode 100644 index 0000000000000..23a0f40232680 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ModernUsageDetail.java @@ -0,0 +1,1094 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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.UUID; + +/** Modern usage detail. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("modern") +@JsonFlatten +@Immutable +public class ModernUsageDetail extends UsageDetailInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ModernUsageDetail.class); + + /* + * Billing Account identifier. + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /* + * Name of the Billing Account. + */ + @JsonProperty(value = "properties.billingAccountName", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountName; + + /* + * Billing Period Start Date as in the invoice. + */ + @JsonProperty(value = "properties.billingPeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime billingPeriodStartDate; + + /* + * Billing Period End Date as in the invoice. + */ + @JsonProperty(value = "properties.billingPeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime billingPeriodEndDate; + + /* + * Identifier for the billing profile that groups costs across invoices in + * the a singular billing currency across across the customers who have + * onboarded the Microsoft customer agreement and the customers in CSP who + * have made entitlement purchases like SaaS, Marketplace, RI, etc. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * Name of the billing profile that groups costs across invoices in the a + * singular billing currency across across the customers who have onboarded + * the Microsoft customer agreement and the customers in CSP who have made + * entitlement purchases like SaaS, Marketplace, RI, etc. + */ + @JsonProperty(value = "properties.billingProfileName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileName; + + /* + * Unique Microsoft generated identifier for the Azure Subscription. + */ + @JsonProperty(value = "properties.subscriptionGuid", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionGuid; + + /* + * Name of the Azure Subscription. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /* + * Date for the usage record. + */ + @JsonProperty(value = "properties.date", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime date; + + /* + * Name of the product that has accrued charges by consumption or purchase + * as listed in the invoice. Not available for Marketplace. + */ + @JsonProperty(value = "properties.product", access = JsonProperty.Access.WRITE_ONLY) + private String product; + + /* + * The meter id (GUID). Not available for marketplace. For reserved + * instance this represents the primary meter for which the reservation was + * purchased. For the actual VM Size for which the reservation is purchased + * see productOrderName. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /* + * Identifies the name of the meter against which consumption is measured. + */ + @JsonProperty(value = "properties.meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /* + * Identifies the location of the datacenter for certain services that are + * priced based on datacenter location. + */ + @JsonProperty(value = "properties.meterRegion", access = JsonProperty.Access.WRITE_ONLY) + private String meterRegion; + + /* + * Identifies the top-level service for the usage. + */ + @JsonProperty(value = "properties.meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /* + * Defines the type or sub-category of Azure service that can affect the + * rate. + */ + @JsonProperty(value = "properties.meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /* + * List the service family for the product purchased or charged (Example: + * Storage ; Compute). + */ + @JsonProperty(value = "properties.serviceFamily", access = JsonProperty.Access.WRITE_ONLY) + private String serviceFamily; + + /* + * Measure the quantity purchased or consumed.The amount of the meter used + * during the billing period. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal quantity; + + /* + * Identifies the Unit that the service is charged in. For example, GB, + * hours, 10,000 s. + */ + @JsonProperty(value = "properties.unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /* + * Instance Name. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /* + * Estimated extendedCost or blended cost before tax in USD. + */ + @JsonProperty(value = "properties.costInUSD", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal costInUsd; + + /* + * Unit Price is the price applicable to you. (your EA or other contract + * price). + */ + @JsonProperty(value = "properties.unitPrice", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal unitPrice; + + /* + * The currency defining the billed cost. + */ + @JsonProperty(value = "properties.billingCurrencyCode", access = JsonProperty.Access.WRITE_ONLY) + private String billingCurrencyCode; + + /* + * Name of the resource location. + */ + @JsonProperty(value = "properties.resourceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String resourceLocation; + + /* + * Consumed service name. Name of the azure resource provider that emits + * the usage or was purchased. This value is not provided for marketplace + * usage. + */ + @JsonProperty(value = "properties.consumedService", access = JsonProperty.Access.WRITE_ONLY) + private String consumedService; + + /* + * Service Info 1. + */ + @JsonProperty(value = "properties.serviceInfo1", access = JsonProperty.Access.WRITE_ONLY) + private String serviceInfo1; + + /* + * Service Info 2. + */ + @JsonProperty(value = "properties.serviceInfo2", access = JsonProperty.Access.WRITE_ONLY) + private String serviceInfo2; + + /* + * Additional details of this usage item. Use this field to get usage line + * item specific details such as the actual VM Size (ServiceType) or the + * ratio in which the reservation discount is applied. + */ + @JsonProperty(value = "properties.additionalInfo", access = JsonProperty.Access.WRITE_ONLY) + private String additionalInfo; + + /* + * Identifier of the project that is being charged in the invoice. Not + * applicable for Microsoft Customer Agreements onboarded by partners. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /* + * Name of the project that is being charged in the invoice. Not applicable + * for Microsoft Customer Agreements onboarded by partners. + */ + @JsonProperty(value = "properties.invoiceSectionName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionName; + + /* + * The cost center of this department if it is a department and a cost + * center is provided. + */ + @JsonProperty(value = "properties.costCenter", access = JsonProperty.Access.WRITE_ONLY) + private String costCenter; + + /* + * Name of the Azure resource group used for cohesive lifecycle management + * of resources. + */ + @JsonProperty(value = "properties.resourceGroup", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroup; + + /* + * ARM resource id of the reservation. Only applies to records relevant to + * reservations. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /* + * User provided display name of the reservation. Last known name for a + * particular day is populated in the daily data. Only applies to records + * relevant to reservations. + */ + @JsonProperty(value = "properties.reservationName", access = JsonProperty.Access.WRITE_ONLY) + private String reservationName; + + /* + * The identifier for the asset or Azure plan name that the subscription + * belongs to. For example: Azure Plan. For reservations this is the + * Reservation Order ID. + */ + @JsonProperty(value = "properties.productOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String productOrderId; + + /* + * Product Order Name. For reservations this is the SKU that was purchased. + */ + @JsonProperty(value = "properties.productOrderName", access = JsonProperty.Access.WRITE_ONLY) + private String productOrderName; + + /* + * Determines if the cost is eligible to be paid for using Azure credits. + */ + @JsonProperty(value = "properties.isAzureCreditEligible", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isAzureCreditEligible; + + /* + * Term (in months). Displays the term for the validity of the offer. For + * example. In case of reserved instances it displays 12 months for yearly + * term of reserved instance. For one time purchases or recurring + * purchases, the terms displays 1 month; This is not applicable for Azure + * consumption. + */ + @JsonProperty(value = "properties.term", access = JsonProperty.Access.WRITE_ONLY) + private String term; + + /* + * Name of the publisher of the service including Microsoft or Third Party + * publishers. + */ + @JsonProperty(value = "properties.publisherName", access = JsonProperty.Access.WRITE_ONLY) + private String publisherName; + + /* + * Type of publisher that identifies if the publisher is first party, third + * party reseller or third party agency. + */ + @JsonProperty(value = "properties.publisherType", access = JsonProperty.Access.WRITE_ONLY) + private String publisherType; + + /* + * Indicates a charge represents credits, usage, a Marketplace purchase, a + * reservation fee, or a refund. + */ + @JsonProperty(value = "properties.chargeType", access = JsonProperty.Access.WRITE_ONLY) + private String chargeType; + + /* + * Indicates how frequently this charge will occur. OneTime for purchases + * which only happen once, Monthly for fees which recur every month, and + * UsageBased for charges based on how much a service is used. + */ + @JsonProperty(value = "properties.frequency", access = JsonProperty.Access.WRITE_ONLY) + private String frequency; + + /* + * ExtendedCost or blended cost before tax in billed currency. + */ + @JsonProperty(value = "properties.costInBillingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal costInBillingCurrency; + + /* + * ExtendedCost or blended cost before tax in pricing currency to correlate + * with prices. + */ + @JsonProperty(value = "properties.costInPricingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal costInPricingCurrency; + + /* + * Exchange rate used in conversion from pricing currency to billing + * currency. + */ + @JsonProperty(value = "properties.exchangeRate", access = JsonProperty.Access.WRITE_ONLY) + private String exchangeRate; + + /* + * Date on which exchange rate used in conversion from pricing currency to + * billing currency. + */ + @JsonProperty(value = "properties.exchangeRateDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime exchangeRateDate; + + /* + * Invoice ID as on the invoice where the specific transaction appears. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /* + * Reference to an original invoice there is a refund (negative cost). This + * is populated only when there is a refund. + */ + @JsonProperty(value = "properties.previousInvoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String previousInvoiceId; + + /* + * Pricing Billing Currency. + */ + @JsonProperty(value = "properties.pricingCurrencyCode", access = JsonProperty.Access.WRITE_ONLY) + private String pricingCurrencyCode; + + /* + * Identifer for the product that has accrued charges by consumption or + * purchase . This is the concatenated key of productId and SKuId in + * partner center. + */ + @JsonProperty(value = "properties.productIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String productIdentifier; + + /* + * Resource Location Normalized. + */ + @JsonProperty(value = "properties.resourceLocationNormalized", access = JsonProperty.Access.WRITE_ONLY) + private String resourceLocationNormalized; + + /* + * Start date for the rating period when the service usage was rated for + * charges. The prices for Azure services are determined for the rating + * period. + */ + @JsonProperty(value = "properties.servicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime servicePeriodStartDate; + + /* + * End date for the period when the service usage was rated for charges. + * The prices for Azure services are determined based on the rating period. + */ + @JsonProperty(value = "properties.servicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime servicePeriodEndDate; + + /* + * Identifier of the customer's AAD tenant. + */ + @JsonProperty(value = "properties.customerTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String customerTenantId; + + /* + * Name of the customer's AAD tenant. + */ + @JsonProperty(value = "properties.customerName", access = JsonProperty.Access.WRITE_ONLY) + private String customerName; + + /* + * Identifier for the partner's AAD tenant. + */ + @JsonProperty(value = "properties.partnerTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String partnerTenantId; + + /* + * Name of the partner' AAD tenant. + */ + @JsonProperty(value = "properties.partnerName", access = JsonProperty.Access.WRITE_ONLY) + private String partnerName; + + /* + * MPNId for the reseller associated with the subscription. + */ + @JsonProperty(value = "properties.resellerMpnId", access = JsonProperty.Access.WRITE_ONLY) + private String resellerMpnId; + + /* + * Reseller Name. + */ + @JsonProperty(value = "properties.resellerName", access = JsonProperty.Access.WRITE_ONLY) + private String resellerName; + + /* + * Publisher Id. + */ + @JsonProperty(value = "properties.publisherId", access = JsonProperty.Access.WRITE_ONLY) + private String publisherId; + + /* + * Market Price that's charged for the usage. + */ + @JsonProperty(value = "properties.marketPrice", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal marketPrice; + + /* + * Exchange Rate from pricing currency to billing currency. + */ + @JsonProperty(value = "properties.exchangeRatePricingToBilling", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal exchangeRatePricingToBilling; + + /* + * The amount of PayG cost before tax in billing currency. + */ + @JsonProperty(value = "properties.paygCostInBillingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal paygCostInBillingCurrency; + + /* + * The amount of PayG cost before tax in US Dollar currency. + */ + @JsonProperty(value = "properties.paygCostInUSD", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal paygCostInUsd; + + /* + * Rate of discount applied if there is a partner earned credit (PEC) based + * on partner admin link access. + */ + @JsonProperty(value = "properties.partnerEarnedCreditRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal partnerEarnedCreditRate; + + /* + * Flag to indicate if partner earned credit has been applied or not. + */ + @JsonProperty(value = "properties.partnerEarnedCreditApplied", access = JsonProperty.Access.WRITE_ONLY) + private String partnerEarnedCreditApplied; + + /** + * Get the billingAccountId property: Billing Account identifier. + * + * @return the billingAccountId value. + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * Get the billingAccountName property: Name of the Billing Account. + * + * @return the billingAccountName value. + */ + public String billingAccountName() { + return this.billingAccountName; + } + + /** + * Get the billingPeriodStartDate property: Billing Period Start Date as in the invoice. + * + * @return the billingPeriodStartDate value. + */ + public OffsetDateTime billingPeriodStartDate() { + return this.billingPeriodStartDate; + } + + /** + * Get the billingPeriodEndDate property: Billing Period End Date as in the invoice. + * + * @return the billingPeriodEndDate value. + */ + public OffsetDateTime billingPeriodEndDate() { + return this.billingPeriodEndDate; + } + + /** + * Get the billingProfileId property: Identifier for the billing profile that groups costs across invoices in the a + * singular billing currency across across the customers who have onboarded the Microsoft customer agreement and the + * customers in CSP who have made entitlement purchases like SaaS, Marketplace, RI, etc. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileName property: Name of the billing profile that groups costs across invoices in the a + * singular billing currency across across the customers who have onboarded the Microsoft customer agreement and the + * customers in CSP who have made entitlement purchases like SaaS, Marketplace, RI, etc. + * + * @return the billingProfileName value. + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Get the subscriptionGuid property: Unique Microsoft generated identifier for the Azure Subscription. + * + * @return the subscriptionGuid value. + */ + public String subscriptionGuid() { + return this.subscriptionGuid; + } + + /** + * Get the subscriptionName property: Name of the Azure Subscription. + * + * @return the subscriptionName value. + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Get the date property: Date for the usage record. + * + * @return the date value. + */ + public OffsetDateTime date() { + return this.date; + } + + /** + * Get the product property: Name of the product that has accrued charges by consumption or purchase as listed in + * the invoice. Not available for Marketplace. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Get the meterId property: The meter id (GUID). Not available for marketplace. For reserved instance this + * represents the primary meter for which the reservation was purchased. For the actual VM Size for which the + * reservation is purchased see productOrderName. + * + * @return the meterId value. + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get the meterName property: Identifies the name of the meter against which consumption is measured. + * + * @return the meterName value. + */ + public String meterName() { + return this.meterName; + } + + /** + * Get the meterRegion property: Identifies the location of the datacenter for certain services that are priced + * based on datacenter location. + * + * @return the meterRegion value. + */ + public String meterRegion() { + return this.meterRegion; + } + + /** + * Get the meterCategory property: Identifies the top-level service for the usage. + * + * @return the meterCategory value. + */ + public String meterCategory() { + return this.meterCategory; + } + + /** + * Get the meterSubCategory property: Defines the type or sub-category of Azure service that can affect the rate. + * + * @return the meterSubCategory value. + */ + public String meterSubCategory() { + return this.meterSubCategory; + } + + /** + * Get the serviceFamily property: List the service family for the product purchased or charged (Example: Storage ; + * Compute). + * + * @return the serviceFamily value. + */ + public String serviceFamily() { + return this.serviceFamily; + } + + /** + * Get the quantity property: Measure the quantity purchased or consumed.The amount of the meter used during the + * billing period. + * + * @return the quantity value. + */ + public BigDecimal quantity() { + return this.quantity; + } + + /** + * Get the unitOfMeasure property: Identifies the Unit that the service is charged in. For example, GB, hours, + * 10,000 s. + * + * @return the unitOfMeasure value. + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get the instanceName property: Instance Name. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the costInUsd property: Estimated extendedCost or blended cost before tax in USD. + * + * @return the costInUsd value. + */ + public BigDecimal costInUsd() { + return this.costInUsd; + } + + /** + * Get the unitPrice property: Unit Price is the price applicable to you. (your EA or other contract price). + * + * @return the unitPrice value. + */ + public BigDecimal unitPrice() { + return this.unitPrice; + } + + /** + * Get the billingCurrencyCode property: The currency defining the billed cost. + * + * @return the billingCurrencyCode value. + */ + public String billingCurrencyCode() { + return this.billingCurrencyCode; + } + + /** + * Get the resourceLocation property: Name of the resource location. + * + * @return the resourceLocation value. + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Get the consumedService property: Consumed service name. Name of the azure resource provider that emits the usage + * or was purchased. This value is not provided for marketplace usage. + * + * @return the consumedService value. + */ + public String consumedService() { + return this.consumedService; + } + + /** + * Get the serviceInfo1 property: Service Info 1. + * + * @return the serviceInfo1 value. + */ + public String serviceInfo1() { + return this.serviceInfo1; + } + + /** + * Get the serviceInfo2 property: Service Info 2. + * + * @return the serviceInfo2 value. + */ + public String serviceInfo2() { + return this.serviceInfo2; + } + + /** + * Get the additionalInfo property: Additional details of this usage item. Use this field to get usage line item + * specific details such as the actual VM Size (ServiceType) or the ratio in which the reservation discount is + * applied. + * + * @return the additionalInfo value. + */ + public String additionalInfo() { + return this.additionalInfo; + } + + /** + * Get the invoiceSectionId property: Identifier of the project that is being charged in the invoice. Not applicable + * for Microsoft Customer Agreements onboarded by partners. + * + * @return the invoiceSectionId value. + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the invoiceSectionName property: Name of the project that is being charged in the invoice. Not applicable for + * Microsoft Customer Agreements onboarded by partners. + * + * @return the invoiceSectionName value. + */ + public String invoiceSectionName() { + return this.invoiceSectionName; + } + + /** + * Get the costCenter property: The cost center of this department if it is a department and a cost center is + * provided. + * + * @return the costCenter value. + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Get the resourceGroup property: Name of the Azure resource group used for cohesive lifecycle management of + * resources. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Get the reservationId property: ARM resource id of the reservation. Only applies to records relevant to + * reservations. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get the reservationName property: User provided display name of the reservation. Last known name for a particular + * day is populated in the daily data. Only applies to records relevant to reservations. + * + * @return the reservationName value. + */ + public String reservationName() { + return this.reservationName; + } + + /** + * Get the productOrderId property: The identifier for the asset or Azure plan name that the subscription belongs + * to. For example: Azure Plan. For reservations this is the Reservation Order ID. + * + * @return the productOrderId value. + */ + public String productOrderId() { + return this.productOrderId; + } + + /** + * Get the productOrderName property: Product Order Name. For reservations this is the SKU that was purchased. + * + * @return the productOrderName value. + */ + public String productOrderName() { + return this.productOrderName; + } + + /** + * Get the isAzureCreditEligible property: Determines if the cost is eligible to be paid for using Azure credits. + * + * @return the isAzureCreditEligible value. + */ + public Boolean isAzureCreditEligible() { + return this.isAzureCreditEligible; + } + + /** + * Get the term property: Term (in months). Displays the term for the validity of the offer. For example. In case of + * reserved instances it displays 12 months for yearly term of reserved instance. For one time purchases or + * recurring purchases, the terms displays 1 month; This is not applicable for Azure consumption. + * + * @return the term value. + */ + public String term() { + return this.term; + } + + /** + * Get the publisherName property: Name of the publisher of the service including Microsoft or Third Party + * publishers. + * + * @return the publisherName value. + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Get the publisherType property: Type of publisher that identifies if the publisher is first party, third party + * reseller or third party agency. + * + * @return the publisherType value. + */ + public String publisherType() { + return this.publisherType; + } + + /** + * Get the chargeType property: Indicates a charge represents credits, usage, a Marketplace purchase, a reservation + * fee, or a refund. + * + * @return the chargeType value. + */ + public String chargeType() { + return this.chargeType; + } + + /** + * Get the frequency property: Indicates how frequently this charge will occur. OneTime for purchases which only + * happen once, Monthly for fees which recur every month, and UsageBased for charges based on how much a service is + * used. + * + * @return the frequency value. + */ + public String frequency() { + return this.frequency; + } + + /** + * Get the costInBillingCurrency property: ExtendedCost or blended cost before tax in billed currency. + * + * @return the costInBillingCurrency value. + */ + public BigDecimal costInBillingCurrency() { + return this.costInBillingCurrency; + } + + /** + * Get the costInPricingCurrency property: ExtendedCost or blended cost before tax in pricing currency to correlate + * with prices. + * + * @return the costInPricingCurrency value. + */ + public BigDecimal costInPricingCurrency() { + return this.costInPricingCurrency; + } + + /** + * Get the exchangeRate property: Exchange rate used in conversion from pricing currency to billing currency. + * + * @return the exchangeRate value. + */ + public String exchangeRate() { + return this.exchangeRate; + } + + /** + * Get the exchangeRateDate property: Date on which exchange rate used in conversion from pricing currency to + * billing currency. + * + * @return the exchangeRateDate value. + */ + public OffsetDateTime exchangeRateDate() { + return this.exchangeRateDate; + } + + /** + * Get the invoiceId property: Invoice ID as on the invoice where the specific transaction appears. + * + * @return the invoiceId value. + */ + public String invoiceId() { + return this.invoiceId; + } + + /** + * Get the previousInvoiceId property: Reference to an original invoice there is a refund (negative cost). This is + * populated only when there is a refund. + * + * @return the previousInvoiceId value. + */ + public String previousInvoiceId() { + return this.previousInvoiceId; + } + + /** + * Get the pricingCurrencyCode property: Pricing Billing Currency. + * + * @return the pricingCurrencyCode value. + */ + public String pricingCurrencyCode() { + return this.pricingCurrencyCode; + } + + /** + * Get the productIdentifier property: Identifer for the product that has accrued charges by consumption or purchase + * . This is the concatenated key of productId and SKuId in partner center. + * + * @return the productIdentifier value. + */ + public String productIdentifier() { + return this.productIdentifier; + } + + /** + * Get the resourceLocationNormalized property: Resource Location Normalized. + * + * @return the resourceLocationNormalized value. + */ + public String resourceLocationNormalized() { + return this.resourceLocationNormalized; + } + + /** + * Get the servicePeriodStartDate property: Start date for the rating period when the service usage was rated for + * charges. The prices for Azure services are determined for the rating period. + * + * @return the servicePeriodStartDate value. + */ + public OffsetDateTime servicePeriodStartDate() { + return this.servicePeriodStartDate; + } + + /** + * Get the servicePeriodEndDate property: End date for the period when the service usage was rated for charges. The + * prices for Azure services are determined based on the rating period. + * + * @return the servicePeriodEndDate value. + */ + public OffsetDateTime servicePeriodEndDate() { + return this.servicePeriodEndDate; + } + + /** + * Get the customerTenantId property: Identifier of the customer's AAD tenant. + * + * @return the customerTenantId value. + */ + public String customerTenantId() { + return this.customerTenantId; + } + + /** + * Get the customerName property: Name of the customer's AAD tenant. + * + * @return the customerName value. + */ + public String customerName() { + return this.customerName; + } + + /** + * Get the partnerTenantId property: Identifier for the partner's AAD tenant. + * + * @return the partnerTenantId value. + */ + public String partnerTenantId() { + return this.partnerTenantId; + } + + /** + * Get the partnerName property: Name of the partner' AAD tenant. + * + * @return the partnerName value. + */ + public String partnerName() { + return this.partnerName; + } + + /** + * Get the resellerMpnId property: MPNId for the reseller associated with the subscription. + * + * @return the resellerMpnId value. + */ + public String resellerMpnId() { + return this.resellerMpnId; + } + + /** + * Get the resellerName property: Reseller Name. + * + * @return the resellerName value. + */ + public String resellerName() { + return this.resellerName; + } + + /** + * Get the publisherId property: Publisher Id. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Get the marketPrice property: Market Price that's charged for the usage. + * + * @return the marketPrice value. + */ + public BigDecimal marketPrice() { + return this.marketPrice; + } + + /** + * Get the exchangeRatePricingToBilling property: Exchange Rate from pricing currency to billing currency. + * + * @return the exchangeRatePricingToBilling value. + */ + public BigDecimal exchangeRatePricingToBilling() { + return this.exchangeRatePricingToBilling; + } + + /** + * Get the paygCostInBillingCurrency property: The amount of PayG cost before tax in billing currency. + * + * @return the paygCostInBillingCurrency value. + */ + public BigDecimal paygCostInBillingCurrency() { + return this.paygCostInBillingCurrency; + } + + /** + * Get the paygCostInUsd property: The amount of PayG cost before tax in US Dollar currency. + * + * @return the paygCostInUsd value. + */ + public BigDecimal paygCostInUsd() { + return this.paygCostInUsd; + } + + /** + * Get the partnerEarnedCreditRate property: Rate of discount applied if there is a partner earned credit (PEC) + * based on partner admin link access. + * + * @return the partnerEarnedCreditRate value. + */ + public BigDecimal partnerEarnedCreditRate() { + return this.partnerEarnedCreditRate; + } + + /** + * Get the partnerEarnedCreditApplied property: Flag to indicate if partner earned credit has been applied or not. + * + * @return the partnerEarnedCreditApplied value. + */ + public String partnerEarnedCreditApplied() { + return this.partnerEarnedCreditApplied; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Notification.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Notification.java new file mode 100644 index 0000000000000..72a1806e3753c --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Notification.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.List; + +/** The notification associated with a budget. */ +@Fluent +public final class Notification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Notification.class); + + /* + * The notification is enabled or not. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * The comparison operator. + */ + @JsonProperty(value = "operator", required = true) + private OperatorType operator; + + /* + * Threshold value associated with a notification. Notification is sent + * when the cost exceeded the threshold. It is always percent and has to be + * between 0 and 1000. + */ + @JsonProperty(value = "threshold", required = true) + private BigDecimal threshold; + + /* + * Email addresses to send the budget notification to when the threshold is + * exceeded. + */ + @JsonProperty(value = "contactEmails", required = true) + private List contactEmails; + + /* + * Contact roles to send the budget notification to when the threshold is + * exceeded. + */ + @JsonProperty(value = "contactRoles") + private List contactRoles; + + /* + * Action groups to send the budget notification to when the threshold is + * exceeded. + */ + @JsonProperty(value = "contactGroups") + private List contactGroups; + + /* + * The type of threshold + */ + @JsonProperty(value = "thresholdType") + private ThresholdType thresholdType; + + /** + * Get the enabled property: The notification is enabled or not. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: The notification is enabled or not. + * + * @param enabled the enabled value to set. + * @return the Notification object itself. + */ + public Notification withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the operator property: The comparison operator. + * + * @return the operator value. + */ + public OperatorType operator() { + return this.operator; + } + + /** + * Set the operator property: The comparison operator. + * + * @param operator the operator value to set. + * @return the Notification object itself. + */ + public Notification withOperator(OperatorType operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold property: Threshold value associated with a notification. Notification is sent when the cost + * exceeded the threshold. It is always percent and has to be between 0 and 1000. + * + * @return the threshold value. + */ + public BigDecimal threshold() { + return this.threshold; + } + + /** + * Set the threshold property: Threshold value associated with a notification. Notification is sent when the cost + * exceeded the threshold. It is always percent and has to be between 0 and 1000. + * + * @param threshold the threshold value to set. + * @return the Notification object itself. + */ + public Notification withThreshold(BigDecimal threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the contactEmails property: Email addresses to send the budget notification to when the threshold is + * exceeded. + * + * @return the contactEmails value. + */ + public List contactEmails() { + return this.contactEmails; + } + + /** + * Set the contactEmails property: Email addresses to send the budget notification to when the threshold is + * exceeded. + * + * @param contactEmails the contactEmails value to set. + * @return the Notification object itself. + */ + public Notification withContactEmails(List contactEmails) { + this.contactEmails = contactEmails; + return this; + } + + /** + * Get the contactRoles property: Contact roles to send the budget notification to when the threshold is exceeded. + * + * @return the contactRoles value. + */ + public List contactRoles() { + return this.contactRoles; + } + + /** + * Set the contactRoles property: Contact roles to send the budget notification to when the threshold is exceeded. + * + * @param contactRoles the contactRoles value to set. + * @return the Notification object itself. + */ + public Notification withContactRoles(List contactRoles) { + this.contactRoles = contactRoles; + return this; + } + + /** + * Get the contactGroups property: Action groups to send the budget notification to when the threshold is exceeded. + * + * @return the contactGroups value. + */ + public List contactGroups() { + return this.contactGroups; + } + + /** + * Set the contactGroups property: Action groups to send the budget notification to when the threshold is exceeded. + * + * @param contactGroups the contactGroups value to set. + * @return the Notification object itself. + */ + public Notification withContactGroups(List contactGroups) { + this.contactGroups = contactGroups; + return this; + } + + /** + * Get the thresholdType property: The type of threshold. + * + * @return the thresholdType value. + */ + public ThresholdType thresholdType() { + return this.thresholdType; + } + + /** + * Set the thresholdType property: The type of threshold. + * + * @param thresholdType the thresholdType value to set. + * @return the Notification object itself. + */ + public Notification withThresholdType(ThresholdType thresholdType) { + this.thresholdType = thresholdType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operator() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property operator in model Notification")); + } + if (threshold() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property threshold in model Notification")); + } + if (contactEmails() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property contactEmails in model Notification")); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Operation.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Operation.java new file mode 100644 index 0000000000000..30593f6b9e0e9 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Operation.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperationDisplay.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperationDisplay.java new file mode 100644 index 0000000000000..78ec9a552cedc --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperationDisplay.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get the provider property: Service provider: Microsoft.Consumption. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperationListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperationListResult.java new file mode 100644 index 0000000000000..2c57455a63d5d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperationListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of listing consumption operations. It contains a list of operations and a URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of consumption operations supported by the Microsoft.Consumption + * resource provider. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of consumption operations supported by the Microsoft.Consumption resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Operations.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Operations.java new file mode 100644 index 0000000000000..fb678e85b69a2 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available consumption REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing consumption operations. + */ + PagedIterable list(); + + /** + * Lists all of the available consumption REST API operations. + * + * @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 result of listing consumption operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperatorType.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperatorType.java new file mode 100644 index 0000000000000..3646bcb45a455 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/OperatorType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperatorType. */ +public final class OperatorType extends ExpandableStringEnum { + /** Static value EqualTo for OperatorType. */ + public static final OperatorType EQUAL_TO = fromString("EqualTo"); + + /** Static value GreaterThan for OperatorType. */ + public static final OperatorType GREATER_THAN = fromString("GreaterThan"); + + /** Static value GreaterThanOrEqualTo for OperatorType. */ + public static final OperatorType GREATER_THAN_OR_EQUAL_TO = fromString("GreaterThanOrEqualTo"); + + /** + * Creates or finds a OperatorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatorType. + */ + @JsonCreator + public static OperatorType fromString(String name) { + return fromString(name, OperatorType.class); + } + + /** @return known OperatorType values. */ + public static Collection values() { + return values(OperatorType.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheetProperties.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheetProperties.java new file mode 100644 index 0000000000000..b6643e12645f8 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheetProperties.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.UUID; + +/** The properties of the price sheet. */ +@Immutable +public final class PriceSheetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PriceSheetProperties.class); + + /* + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /* + * The meter id (GUID) + */ + @JsonProperty(value = "meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /* + * The details about the meter. By default this is not populated, unless + * it's specified in $expand. + */ + @JsonProperty(value = "meterDetails", access = JsonProperty.Access.WRITE_ONLY) + private MeterDetails meterDetails; + + /* + * Unit of measure + */ + @JsonProperty(value = "unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /* + * Included quality for an offer + */ + @JsonProperty(value = "includedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal includedQuantity; + + /* + * Part Number + */ + @JsonProperty(value = "partNumber", access = JsonProperty.Access.WRITE_ONLY) + private String partNumber; + + /* + * Unit Price + */ + @JsonProperty(value = "unitPrice", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal unitPrice; + + /* + * Currency Code + */ + @JsonProperty(value = "currencyCode", access = JsonProperty.Access.WRITE_ONLY) + private String currencyCode; + + /* + * Offer Id + */ + @JsonProperty(value = "offerId", access = JsonProperty.Access.WRITE_ONLY) + private String offerId; + + /** + * Get the billingPeriodId property: The id of the billing period resource that the usage belongs to. + * + * @return the billingPeriodId value. + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get the meterId property: The meter id (GUID). + * + * @return the meterId value. + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get the meterDetails property: The details about the meter. By default this is not populated, unless it's + * specified in $expand. + * + * @return the meterDetails value. + */ + public MeterDetails meterDetails() { + return this.meterDetails; + } + + /** + * Get the unitOfMeasure property: Unit of measure. + * + * @return the unitOfMeasure value. + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get the includedQuantity property: Included quality for an offer. + * + * @return the includedQuantity value. + */ + public BigDecimal includedQuantity() { + return this.includedQuantity; + } + + /** + * Get the partNumber property: Part Number. + * + * @return the partNumber value. + */ + public String partNumber() { + return this.partNumber; + } + + /** + * Get the unitPrice property: Unit Price. + * + * @return the unitPrice value. + */ + public BigDecimal unitPrice() { + return this.unitPrice; + } + + /** + * Get the currencyCode property: Currency Code. + * + * @return the currencyCode value. + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Get the offerId property: Offer Id. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (meterDetails() != null) { + meterDetails().validate(); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheetResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheetResult.java new file mode 100644 index 0000000000000..563fb4320e1f6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheetResult.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.PriceSheetResultInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of PriceSheetResult. */ +public interface PriceSheetResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the pricesheets property: Price sheet. + * + * @return the pricesheets value. + */ + List pricesheets(); + + /** + * Gets the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.PriceSheetResultInner object. + * + * @return the inner object. + */ + PriceSheetResultInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheets.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheets.java new file mode 100644 index 0000000000000..90f922a28aa4d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/PriceSheets.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PriceSheets. */ +public interface PriceSheets { + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @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 price sheet for a scope by subscriptionId. + */ + PriceSheetResult get(); + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or + * later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId. + */ + Response getWithResponse(String expand, String skiptoken, Integer top, Context context); + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + PriceSheetResult getByBillingPeriod(String billingPeriodName); + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only + * for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields + * are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 price sheet for a scope by subscriptionId and billing period. + */ + Response getByBillingPeriodWithResponse( + String billingPeriodName, String expand, String skiptoken, Integer top, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationDetail.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationDetail.java new file mode 100644 index 0000000000000..e5e6624041add --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationDetail.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ReservationDetailInner; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of ReservationDetail. */ +public interface ReservationDetail { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the reservationOrderId property: The reservation order ID is the identifier for a reservation purchase. Each + * reservation order ID represents a single purchase transaction. A reservation order contains reservations. The + * reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * Gets the instanceFlexibilityRatio property: The instance Flexibility Ratio. + * + * @return the instanceFlexibilityRatio value. + */ + String instanceFlexibilityRatio(); + + /** + * Gets the instanceFlexibilityGroup property: The instance Flexibility Group. + * + * @return the instanceFlexibilityGroup value. + */ + String instanceFlexibilityGroup(); + + /** + * Gets the reservationId property: The reservation ID is the identifier of a reservation within a reservation + * order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances + * to which the reservation benefit can be applied to. + * + * @return the reservationId value. + */ + String reservationId(); + + /** + * Gets the skuName property: This is the ARM Sku name. It can be used to join with the serviceType field in + * additional info in usage records. + * + * @return the skuName value. + */ + String skuName(); + + /** + * Gets the reservedHours property: This is the total hours reserved for the day. E.g. if reservation for 1 instance + * was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * Gets the usageDate property: The date on which consumption occurred. + * + * @return the usageDate value. + */ + OffsetDateTime usageDate(); + + /** + * Gets the usedHours property: This is the total hours used by the instance. + * + * @return the usedHours value. + */ + BigDecimal usedHours(); + + /** + * Gets the instanceId property: This identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value. + */ + String instanceId(); + + /** + * Gets the totalReservedQuantity property: This is the total count of instances that are reserved for the + * reservationId. + * + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * Gets the kind property: The reservation kind. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ReservationDetailInner object. + * + * @return the inner object. + */ + ReservationDetailInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationDetailsListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationDetailsListResult.java new file mode 100644 index 0000000000000..ffb854c4b8ff5 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationDetailsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ReservationDetailInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing reservation details. */ +@Immutable +public final class ReservationDetailsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationDetailsListResult.class); + + /* + * The list of reservation details. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of reservation details. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendation.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendation.java new file mode 100644 index 0000000000000..15185bcd5d5fd --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendation.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationInner; +import java.util.Map; + +/** An immutable client-side representation of ReservationRecommendation. */ +public interface ReservationRecommendation { + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the sku property: Resource sku. + * + * @return the sku value. + */ + String sku(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationInner object. + * + * @return the inner object. + */ + ReservationRecommendationInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetails.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetails.java new file mode 100644 index 0000000000000..c7454899d8314 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetails.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ReservationRecommendationDetails. */ +public interface ReservationRecommendationDetails { + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + ReservationRecommendationDetailsModel get( + String billingScope, Scope scope, String region, Term term, LookBackPeriod lookBackPeriod, String product); + + /** + * Details of a reservation recommendation for what-if analysis of reserved instances. + * + * @param billingScope The scope associated with reservation recommendation details operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param scope Scope of the reservation. + * @param region Used to select the region the recommendation should be generated for. + * @param term Specify length of reservation recommendation term. + * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. + * @param product Filter the products for which reservation recommendation results are generated. Examples: + * Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + * @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 reservation recommendation details. + */ + Response getWithResponse( + String billingScope, + Scope scope, + String region, + Term term, + LookBackPeriod lookBackPeriod, + String product, + Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsCalculatedSavingsProperties.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsCalculatedSavingsProperties.java new file mode 100644 index 0000000000000..4810f2254a22d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsCalculatedSavingsProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of estimated savings. */ +@Fluent +public final class ReservationRecommendationDetailsCalculatedSavingsProperties { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(ReservationRecommendationDetailsCalculatedSavingsProperties.class); + + /* + * The cost without reservation. + */ + @JsonProperty(value = "onDemandCost", access = JsonProperty.Access.WRITE_ONLY) + private Float onDemandCost; + + /* + * The difference between total reservation cost and reservation cost. + */ + @JsonProperty(value = "overageCost", access = JsonProperty.Access.WRITE_ONLY) + private Float overageCost; + + /* + * The quantity for calculated savings. + */ + @JsonProperty(value = "quantity", access = JsonProperty.Access.WRITE_ONLY) + private Float quantity; + + /* + * The exact cost of the estimated usage using reservation. + */ + @JsonProperty(value = "reservationCost", access = JsonProperty.Access.WRITE_ONLY) + private Float reservationCost; + + /* + * The cost of the suggested quantity. + */ + @JsonProperty(value = "totalReservationCost", access = JsonProperty.Access.WRITE_ONLY) + private Float totalReservationCost; + + /* + * The number of reserved units used to calculate savings. Always 1 for + * virtual machines. + */ + @JsonProperty(value = "reservedUnitCount") + private Float reservedUnitCount; + + /* + * The amount saved by purchasing the recommended quantity of reservation. + */ + @JsonProperty(value = "savings", access = JsonProperty.Access.WRITE_ONLY) + private Float savings; + + /** + * Get the onDemandCost property: The cost without reservation. + * + * @return the onDemandCost value. + */ + public Float onDemandCost() { + return this.onDemandCost; + } + + /** + * Get the overageCost property: The difference between total reservation cost and reservation cost. + * + * @return the overageCost value. + */ + public Float overageCost() { + return this.overageCost; + } + + /** + * Get the quantity property: The quantity for calculated savings. + * + * @return the quantity value. + */ + public Float quantity() { + return this.quantity; + } + + /** + * Get the reservationCost property: The exact cost of the estimated usage using reservation. + * + * @return the reservationCost value. + */ + public Float reservationCost() { + return this.reservationCost; + } + + /** + * Get the totalReservationCost property: The cost of the suggested quantity. + * + * @return the totalReservationCost value. + */ + public Float totalReservationCost() { + return this.totalReservationCost; + } + + /** + * Get the reservedUnitCount property: The number of reserved units used to calculate savings. Always 1 for virtual + * machines. + * + * @return the reservedUnitCount value. + */ + public Float reservedUnitCount() { + return this.reservedUnitCount; + } + + /** + * Set the reservedUnitCount property: The number of reserved units used to calculate savings. Always 1 for virtual + * machines. + * + * @param reservedUnitCount the reservedUnitCount value to set. + * @return the ReservationRecommendationDetailsCalculatedSavingsProperties object itself. + */ + public ReservationRecommendationDetailsCalculatedSavingsProperties withReservedUnitCount(Float reservedUnitCount) { + this.reservedUnitCount = reservedUnitCount; + return this; + } + + /** + * Get the savings property: The amount saved by purchasing the recommended quantity of reservation. + * + * @return the savings value. + */ + public Float savings() { + return this.savings; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsModel.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsModel.java new file mode 100644 index 0000000000000..cef736f5267b6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsModel.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationDetailsModelInner; +import java.util.Map; + +/** An immutable client-side representation of ReservationRecommendationDetailsModel. */ +public interface ReservationRecommendationDetailsModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource Location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the sku property: Resource sku. + * + * @return the sku value. + */ + String sku(); + + /** + * Gets the currency property: An ISO 4217 currency code identifier for the costs and savings. + * + * @return the currency value. + */ + String currency(); + + /** + * Gets the resource property: Resource specific properties. + * + * @return the resource value. + */ + ReservationRecommendationDetailsResourceProperties resource(); + + /** + * Gets the resourceGroup property: Resource Group. + * + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * Gets the savings property: Savings information for the recommendation. + * + * @return the savings value. + */ + ReservationRecommendationDetailsSavingsProperties savings(); + + /** + * Gets the scope property: Scope of the reservation, ex: Single or Shared. + * + * @return the scope value. + */ + String scope(); + + /** + * Gets the usage property: Historical usage details used to calculate the estimated savings. + * + * @return the usage value. + */ + ReservationRecommendationDetailsUsageProperties usage(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationDetailsModelInner + * object. + * + * @return the inner object. + */ + ReservationRecommendationDetailsModelInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsResourceProperties.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsResourceProperties.java new file mode 100644 index 0000000000000..3835bf3903d94 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsResourceProperties.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details of the resource. */ +@Immutable +public final class ReservationRecommendationDetailsResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ReservationRecommendationDetailsResourceProperties.class); + + /* + * List of subscriptions for which the reservation is applied. + */ + @JsonProperty(value = "appliedScopes", access = JsonProperty.Access.WRITE_ONLY) + private List appliedScopes; + + /* + * On demand rate of the resource. + */ + @JsonProperty(value = "onDemandRate", access = JsonProperty.Access.WRITE_ONLY) + private Float onDemandRate; + + /* + * Azure product ex: Standard_E8s_v3 etc. + */ + @JsonProperty(value = "product", access = JsonProperty.Access.WRITE_ONLY) + private String product; + + /* + * Azure resource region ex:EastUS, WestUS etc. + */ + @JsonProperty(value = "region", access = JsonProperty.Access.WRITE_ONLY) + private String region; + + /* + * Reservation rate of the resource. + */ + @JsonProperty(value = "reservationRate", access = JsonProperty.Access.WRITE_ONLY) + private Float reservationRate; + + /* + * The azure resource type. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /** + * Get the appliedScopes property: List of subscriptions for which the reservation is applied. + * + * @return the appliedScopes value. + */ + public List appliedScopes() { + return this.appliedScopes; + } + + /** + * Get the onDemandRate property: On demand rate of the resource. + * + * @return the onDemandRate value. + */ + public Float onDemandRate() { + return this.onDemandRate; + } + + /** + * Get the product property: Azure product ex: Standard_E8s_v3 etc. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Get the region property: Azure resource region ex:EastUS, WestUS etc. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Get the reservationRate property: Reservation rate of the resource. + * + * @return the reservationRate value. + */ + public Float reservationRate() { + return this.reservationRate; + } + + /** + * Get the resourceType property: The azure resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsSavingsProperties.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsSavingsProperties.java new file mode 100644 index 0000000000000..7753a58ff4e0c --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsSavingsProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details of the estimated savings. */ +@Fluent +public final class ReservationRecommendationDetailsSavingsProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ReservationRecommendationDetailsSavingsProperties.class); + + /* + * List of calculated savings. + */ + @JsonProperty(value = "calculatedSavings") + private List calculatedSavings; + + /* + * Number of days of usage to look back used for computing the + * recommendation. + */ + @JsonProperty(value = "lookBackPeriod", access = JsonProperty.Access.WRITE_ONLY) + private Integer lookBackPeriod; + + /* + * Number of recommended units of the resource. + */ + @JsonProperty(value = "recommendedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private Float recommendedQuantity; + + /* + * Term period of the reservation, ex: P1Y or P3Y. + */ + @JsonProperty(value = "reservationOrderTerm", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderTerm; + + /* + * Type of savings, ex: instance. + */ + @JsonProperty(value = "savingsType", access = JsonProperty.Access.WRITE_ONLY) + private String savingsType; + + /* + * Measurement unit ex: hour etc. + */ + @JsonProperty(value = "unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /** + * Get the calculatedSavings property: List of calculated savings. + * + * @return the calculatedSavings value. + */ + public List calculatedSavings() { + return this.calculatedSavings; + } + + /** + * Set the calculatedSavings property: List of calculated savings. + * + * @param calculatedSavings the calculatedSavings value to set. + * @return the ReservationRecommendationDetailsSavingsProperties object itself. + */ + public ReservationRecommendationDetailsSavingsProperties withCalculatedSavings( + List calculatedSavings) { + this.calculatedSavings = calculatedSavings; + return this; + } + + /** + * Get the lookBackPeriod property: Number of days of usage to look back used for computing the recommendation. + * + * @return the lookBackPeriod value. + */ + public Integer lookBackPeriod() { + return this.lookBackPeriod; + } + + /** + * Get the recommendedQuantity property: Number of recommended units of the resource. + * + * @return the recommendedQuantity value. + */ + public Float recommendedQuantity() { + return this.recommendedQuantity; + } + + /** + * Get the reservationOrderTerm property: Term period of the reservation, ex: P1Y or P3Y. + * + * @return the reservationOrderTerm value. + */ + public String reservationOrderTerm() { + return this.reservationOrderTerm; + } + + /** + * Get the savingsType property: Type of savings, ex: instance. + * + * @return the savingsType value. + */ + public String savingsType() { + return this.savingsType; + } + + /** + * Get the unitOfMeasure property: Measurement unit ex: hour etc. + * + * @return the unitOfMeasure value. + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (calculatedSavings() != null) { + calculatedSavings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsUsageProperties.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsUsageProperties.java new file mode 100644 index 0000000000000..76d401214b2f0 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationDetailsUsageProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details about historical usage data that has been used for computing the recommendation. */ +@Immutable +public final class ReservationRecommendationDetailsUsageProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ReservationRecommendationDetailsUsageProperties.class); + + /* + * The first usage date used for looking back for computing the + * recommendation. + */ + @JsonProperty(value = "firstConsumptionDate", access = JsonProperty.Access.WRITE_ONLY) + private String firstConsumptionDate; + + /* + * The last usage date used for looking back for computing the + * recommendation. + */ + @JsonProperty(value = "lastConsumptionDate", access = JsonProperty.Access.WRITE_ONLY) + private String lastConsumptionDate; + + /* + * What the usage data values represent ex: virtual machine instance. + */ + @JsonProperty(value = "lookBackUnitType", access = JsonProperty.Access.WRITE_ONLY) + private String lookBackUnitType; + + /* + * The breakdown of historical resource usage. The values are in the order + * of usage between the firstConsumptionDate and the lastConsumptionDate. + */ + @JsonProperty(value = "usageData", access = JsonProperty.Access.WRITE_ONLY) + private List usageData; + + /* + * The grain of the values represented in the usage data ex: hourly. + */ + @JsonProperty(value = "usageGrain", access = JsonProperty.Access.WRITE_ONLY) + private String usageGrain; + + /** + * Get the firstConsumptionDate property: The first usage date used for looking back for computing the + * recommendation. + * + * @return the firstConsumptionDate value. + */ + public String firstConsumptionDate() { + return this.firstConsumptionDate; + } + + /** + * Get the lastConsumptionDate property: The last usage date used for looking back for computing the recommendation. + * + * @return the lastConsumptionDate value. + */ + public String lastConsumptionDate() { + return this.lastConsumptionDate; + } + + /** + * Get the lookBackUnitType property: What the usage data values represent ex: virtual machine instance. + * + * @return the lookBackUnitType value. + */ + public String lookBackUnitType() { + return this.lookBackUnitType; + } + + /** + * Get the usageData property: The breakdown of historical resource usage. The values are in the order of usage + * between the firstConsumptionDate and the lastConsumptionDate. + * + * @return the usageData value. + */ + public List usageData() { + return this.usageData; + } + + /** + * Get the usageGrain property: The grain of the values represented in the usage data ex: hourly. + * + * @return the usageGrain value. + */ + public String usageGrain() { + return this.usageGrain; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationKind.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationKind.java new file mode 100644 index 0000000000000..0111aee932c51 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationKind.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReservationRecommendationKind. */ +public final class ReservationRecommendationKind extends ExpandableStringEnum { + /** Static value legacy for ReservationRecommendationKind. */ + public static final ReservationRecommendationKind LEGACY = fromString("legacy"); + + /** Static value modern for ReservationRecommendationKind. */ + public static final ReservationRecommendationKind MODERN = fromString("modern"); + + /** + * Creates or finds a ReservationRecommendationKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReservationRecommendationKind. + */ + @JsonCreator + public static ReservationRecommendationKind fromString(String name) { + return fromString(name, ReservationRecommendationKind.class); + } + + /** @return known ReservationRecommendationKind values. */ + public static Collection values() { + return values(ReservationRecommendationKind.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendations.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendations.java new file mode 100644 index 0000000000000..adae056eabfe6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendations.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ReservationRecommendations. */ +public interface ReservationRecommendations { + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + PagedIterable list(String scope); + + /** + * List of recommendations for purchasing reserved instances. + * + * @param scope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope. + * @param filter May be used to filter reservationRecommendations by: properties/scope with allowed values + * ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values + * ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', + * 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', + * 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values + * ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + * @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 result of listing reservation recommendations. + */ + PagedIterable list(String scope, String filter, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationsListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationsListResult.java new file mode 100644 index 0000000000000..3a9b440ac3078 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationRecommendationsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing reservation recommendations. */ +@Immutable +public final class ReservationRecommendationsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationRecommendationsListResult.class); + + /* + * The list of reservation recommendations. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of reservation recommendations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationSummariesListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationSummariesListResult.java new file mode 100644 index 0000000000000..e355ec17c10d4 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationSummariesListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing reservation summaries. */ +@Immutable +public final class ReservationSummariesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationSummariesListResult.class); + + /* + * The list of reservation summaries. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of reservation summaries. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationSummary.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationSummary.java new file mode 100644 index 0000000000000..77623d9988fdd --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationSummary.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of ReservationSummary. */ +public interface ReservationSummary { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the reservationOrderId property: The reservation order ID is the identifier for a reservation purchase. Each + * reservation order ID represents a single purchase transaction. A reservation order contains reservations. The + * reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * Gets the reservationId property: The reservation ID is the identifier of a reservation within a reservation + * order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances + * to which the reservation benefit can be applied to. + * + * @return the reservationId value. + */ + String reservationId(); + + /** + * Gets the skuName property: This is the ARM Sku name. It can be used to join with the serviceType field in + * additional info in usage records. + * + * @return the skuName value. + */ + String skuName(); + + /** + * Gets the reservedHours property: This is the total hours reserved. E.g. if reservation for 1 instance was made on + * 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * Gets the usageDate property: Data corresponding to the utilization record. If the grain of data is monthly, it + * will be first day of month. + * + * @return the usageDate value. + */ + OffsetDateTime usageDate(); + + /** + * Gets the usedHours property: Total used hours by the reservation. + * + * @return the usedHours value. + */ + BigDecimal usedHours(); + + /** + * Gets the minUtilizationPercentage property: This is the minimum hourly utilization in the usage time (day or + * month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this + * field will return 10% for that day. + * + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * Gets the avgUtilizationPercentage property: This is average utilization for the entire time range. (day or month + * depending on the grain). + * + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * Gets the maxUtilizationPercentage property: This is the maximum hourly utilization in the usage time (day or + * month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this + * field will return 100% for that day. + * + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * Gets the kind property: The reservation kind. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the purchasedQuantity property: This is the purchased quantity for the reservationId. + * + * @return the purchasedQuantity value. + */ + BigDecimal purchasedQuantity(); + + /** + * Gets the remainingQuantity property: This is the remaining quantity for the reservationId. + * + * @return the remainingQuantity value. + */ + BigDecimal remainingQuantity(); + + /** + * Gets the totalReservedQuantity property: This is the total count of instances that are reserved for the + * reservationId. + * + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * Gets the usedQuantity property: This is the used quantity for the reservationId. + * + * @return the usedQuantity value. + */ + BigDecimal usedQuantity(); + + /** + * Gets the utilizedPercentage property: This is the utilized percentage for the reservation Id. + * + * @return the utilizedPercentage value. + */ + BigDecimal utilizedPercentage(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner object. + * + * @return the inner object. + */ + ReservationSummaryInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransaction.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransaction.java new file mode 100644 index 0000000000000..3375cf8d1da9b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransaction.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.ReservationTransactionInner; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ReservationTransaction. */ +public interface ReservationTransaction { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + List tags(); + + /** + * Gets the eventDate property: The date of the transaction. + * + * @return the eventDate value. + */ + OffsetDateTime eventDate(); + + /** + * Gets the reservationOrderId property: The reservation order ID is the identifier for a reservation purchase. Each + * reservation order ID represents a single purchase transaction. A reservation order contains reservations. The + * reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * Gets the description property: The description of the transaction. + * + * @return the description value. + */ + String description(); + + /** + * Gets the eventType property: The type of the transaction (Purchase, Cancel, etc.). + * + * @return the eventType value. + */ + String eventType(); + + /** + * Gets the quantity property: The quantity of the transaction. + * + * @return the quantity value. + */ + BigDecimal quantity(); + + /** + * Gets the amount property: The charge of the transaction. + * + * @return the amount value. + */ + BigDecimal amount(); + + /** + * Gets the currency property: The ISO currency in which the transaction is charged, for example, USD. + * + * @return the currency value. + */ + String currency(); + + /** + * Gets the reservationOrderName property: The name of the reservation order. + * + * @return the reservationOrderName value. + */ + String reservationOrderName(); + + /** + * Gets the purchasingEnrollment property: The purchasing enrollment. + * + * @return the purchasingEnrollment value. + */ + String purchasingEnrollment(); + + /** + * Gets the purchasingSubscriptionGuid property: The subscription guid that makes the transaction. + * + * @return the purchasingSubscriptionGuid value. + */ + UUID purchasingSubscriptionGuid(); + + /** + * Gets the purchasingSubscriptionName property: The subscription name that makes the transaction. + * + * @return the purchasingSubscriptionName value. + */ + String purchasingSubscriptionName(); + + /** + * Gets the armSkuName property: This is the ARM Sku name. It can be used to join with the serviceType field in + * additional info in usage records. + * + * @return the armSkuName value. + */ + String armSkuName(); + + /** + * Gets the term property: This is the term of the transaction. + * + * @return the term value. + */ + String term(); + + /** + * Gets the region property: The region of the transaction. + * + * @return the region value. + */ + String region(); + + /** + * Gets the accountName property: The name of the account that makes the transaction. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the accountOwnerEmail property: The email of the account owner that makes the transaction. + * + * @return the accountOwnerEmail value. + */ + String accountOwnerEmail(); + + /** + * Gets the departmentName property: The department name. + * + * @return the departmentName value. + */ + String departmentName(); + + /** + * Gets the costCenter property: The cost center of this department if it is a department and a cost center is + * provided. + * + * @return the costCenter value. + */ + String costCenter(); + + /** + * Gets the currentEnrollment property: The current enrollment. + * + * @return the currentEnrollment value. + */ + String currentEnrollment(); + + /** + * Gets the billingFrequency property: The billing frequency, which can be either one-time or recurring. + * + * @return the billingFrequency value. + */ + String billingFrequency(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.ReservationTransactionInner object. + * + * @return the inner object. + */ + ReservationTransactionInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactionResource.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactionResource.java new file mode 100644 index 0000000000000..16d5361a2471b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactionResource.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The Resource model definition. */ +@Immutable +public class ReservationTransactionResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationTransactionResource.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private List tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public List tags() { + return this.tags; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactions.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactions.java new file mode 100644 index 0000000000000..5fc85b543a975 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactions.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ReservationTransactions. */ +public interface ReservationTransactions { + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + PagedIterable list(String billingAccountId); + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + PagedIterable list(String billingAccountId, String filter, Context context); + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation recommendations. + */ + PagedIterable listByBillingProfile(String billingAccountId, String billingProfileId); + + /** + * List of transactions for reserved instances on billing account scope. + * + * @param billingAccountId BillingAccount ID. + * @param billingProfileId Azure Billing Profile ID. + * @param filter Filter reservation transactions by date range. The properties/EventDate for start date and end + * date. The filter supports 'le' and 'ge'. + * @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 result of listing reservation recommendations. + */ + PagedIterable listByBillingProfile( + String billingAccountId, String billingProfileId, String filter, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactionsListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactionsListResult.java new file mode 100644 index 0000000000000..f79c313d6d236 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationTransactionsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.ReservationTransactionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing reservation recommendations. */ +@Immutable +public final class ReservationTransactionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationTransactionsListResult.class); + + /* + * The list of reservation recommendations. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of reservation recommendations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationsDetails.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationsDetails.java new file mode 100644 index 0000000000000..0bc6bc3f035af --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationsDetails.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ReservationsDetails. */ +public interface ReservationsDetails { + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + PagedIterable listByReservationOrder(String reservationOrderId, String filter); + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + PagedIterable listByReservationOrder(String reservationOrderId, String filter, Context context); + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, String filter); + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. + * @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 result of listing reservation details. + */ + PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, String filter, Context context); + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation details. + */ + PagedIterable list(String scope); + + /** + * Lists the reservations details for the defined scope and provided date range. + * + * @param scope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The + * filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation details. + */ + PagedIterable list( + String scope, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationsSummaries.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationsSummaries.java new file mode 100644 index 0000000000000..a5c07b494c6c8 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ReservationsSummaries.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ReservationsSummaries. */ +public interface ReservationsSummaries { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + PagedIterable listByReservationOrder(String reservationOrderId, Datagrain grain); + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + PagedIterable listByReservationOrder( + String reservationOrderId, Datagrain grain, String filter, Context context); + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, Datagrain grain); + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation. + * @param grain Can be daily or monthly. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. + * @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 result of listing reservation summaries. + */ + PagedIterable listByReservationOrderAndReservation( + String reservationOrderId, String reservationId, Datagrain grain, String filter, Context context); + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing reservation summaries. + */ + PagedIterable list(String scope, Datagrain grain); + + /** + * Lists the reservations summaries for the defined scope daily or monthly grain. + * + * @param scope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * BillingProfile scope (modern). + * @param grain Can be daily or monthly. + * @param startDate Start date. Only applicable when querying with billing profile. + * @param endDate End date. Only applicable when querying with billing profile. + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter + * supports 'le' and 'ge'. Not applicable when querying with billing profile. + * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific + * reservation. + * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific + * reservation order. + * @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 result of listing reservation summaries. + */ + PagedIterable list( + String scope, + Datagrain grain, + String startDate, + String endDate, + String filter, + String reservationId, + String reservationOrderId, + Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ResourceAttributes.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ResourceAttributes.java new file mode 100644 index 0000000000000..267f6e808f6a4 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ResourceAttributes.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Resource model definition. */ +@Immutable +public class ResourceAttributes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceAttributes.class); + + /* + * Resource location + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource sku + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the sku property: Resource sku. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Scope.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Scope.java new file mode 100644 index 0000000000000..288a61c2d4739 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Scope.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Scope. */ +public final class Scope extends ExpandableStringEnum { + /** Static value Single for Scope. */ + public static final Scope SINGLE = fromString("Single"); + + /** Static value Shared for Scope. */ + public static final Scope SHARED = fromString("Shared"); + + /** + * Creates or finds a Scope from its string representation. + * + * @param name a name to look for. + * @return the corresponding Scope. + */ + @JsonCreator + public static Scope fromString(String name) { + return fromString(name, Scope.class); + } + + /** @return known Scope values. */ + public static Collection values() { + return values(Scope.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/SkuProperty.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/SkuProperty.java new file mode 100644 index 0000000000000..5f4126be75357 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/SkuProperty.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Sku property. */ +@Immutable +public final class SkuProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SkuProperty.class); + + /* + * The name of sku property. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The value of sku property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * Get the name property: The name of sku property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: The value of sku property. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Tag.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Tag.java new file mode 100644 index 0000000000000..adc5ebdd7b7da --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Tag.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The tag resource. */ +@Fluent +public final class Tag { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Tag.class); + + /* + * Tag key. + */ + @JsonProperty(value = "key") + private String key; + + /** + * Get the key property: Tag key. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: Tag key. + * + * @param key the key value to set. + * @return the Tag object itself. + */ + public Tag withKey(String key) { + this.key = key; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Tags.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Tags.java new file mode 100644 index 0000000000000..45decbb6eebb3 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Tags.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Tags. */ +public interface Tags { + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available tag keys for the defined scope. + */ + TagsResult get(String scope); + + /** + * Get all available tag keys for the defined scope. + * + * @param scope The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for + * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup + * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department + * scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + * for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + * Management Group scope.. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available tag keys for the defined scope. + */ + Response getWithResponse(String scope, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/TagsResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/TagsResult.java new file mode 100644 index 0000000000000..20660d43a7b1d --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/TagsResult.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.TagsResultInner; +import java.util.List; + +/** An immutable client-side representation of TagsResult. */ +public interface TagsResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the tags property: A list of Tag. + * + * @return the tags value. + */ + List tags(); + + /** + * Gets the etag property: eTag of the resource. To handle concurrent update scenario, this field will be used to + * determine whether the user is updating the latest version or not. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.TagsResultInner object. + * + * @return the inner object. + */ + TagsResultInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Term.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Term.java new file mode 100644 index 0000000000000..bf14eb811c572 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/Term.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Term. */ +public final class Term extends ExpandableStringEnum { + /** Static value P1Y for Term. */ + public static final Term P1Y = fromString("P1Y"); + + /** Static value P3Y for Term. */ + public static final Term P3Y = fromString("P3Y"); + + /** + * Creates or finds a Term from its string representation. + * + * @param name a name to look for. + * @return the corresponding Term. + */ + @JsonCreator + public static Term fromString(String name) { + return fromString(name, Term.class); + } + + /** @return known Term values. */ + public static Collection values() { + return values(Term.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ThresholdType.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ThresholdType.java new file mode 100644 index 0000000000000..737b518aca615 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/ThresholdType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ThresholdType. */ +public final class ThresholdType extends ExpandableStringEnum { + /** Static value Actual for ThresholdType. */ + public static final ThresholdType ACTUAL = fromString("Actual"); + + /** + * Creates or finds a ThresholdType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ThresholdType. + */ + @JsonCreator + public static ThresholdType fromString(String name) { + return fromString(name, ThresholdType.class); + } + + /** @return known ThresholdType values. */ + public static Collection values() { + return values(ThresholdType.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/TimeGrainType.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/TimeGrainType.java new file mode 100644 index 0000000000000..2da37ebc4ab5e --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/TimeGrainType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TimeGrainType. */ +public final class TimeGrainType extends ExpandableStringEnum { + /** Static value Monthly for TimeGrainType. */ + public static final TimeGrainType MONTHLY = fromString("Monthly"); + + /** Static value Quarterly for TimeGrainType. */ + public static final TimeGrainType QUARTERLY = fromString("Quarterly"); + + /** Static value Annually for TimeGrainType. */ + public static final TimeGrainType ANNUALLY = fromString("Annually"); + + /** Static value BillingMonth for TimeGrainType. */ + public static final TimeGrainType BILLING_MONTH = fromString("BillingMonth"); + + /** Static value BillingQuarter for TimeGrainType. */ + public static final TimeGrainType BILLING_QUARTER = fromString("BillingQuarter"); + + /** Static value BillingAnnual for TimeGrainType. */ + public static final TimeGrainType BILLING_ANNUAL = fromString("BillingAnnual"); + + /** + * Creates or finds a TimeGrainType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TimeGrainType. + */ + @JsonCreator + public static TimeGrainType fromString(String name) { + return fromString(name, TimeGrainType.class); + } + + /** @return known TimeGrainType values. */ + public static Collection values() { + return values(TimeGrainType.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetail.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetail.java new file mode 100644 index 0000000000000..cc8ad37b59852 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetail.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner; +import java.util.Map; + +/** An immutable client-side representation of UsageDetail. */ +public interface UsageDetail { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner object. + * + * @return the inner object. + */ + UsageDetailInner innerModel(); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetails.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetails.java new file mode 100644 index 0000000000000..61734c007e496 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetails.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of UsageDetails. */ +public interface UsageDetails { + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing usage details. + */ + PagedIterable list(String scope); + + /** + * Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param scope The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' + * for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account + * scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + * '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and + * '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For + * subscription, billing account, department, enrollment account and management group, you can also add billing + * period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to + * specify billing period at department scope use + * '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + * Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + * for billingAccount scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for + * billingProfile scope, + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + * for invoiceSection scope, and + * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for + * partners. + * @param expand May be used to expand the properties/additionalInfo or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, + * properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The + * filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter + * accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param metric Allows to select different type of cost/usage records. + * @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 result of listing usage details. + */ + PagedIterable list( + String scope, String expand, String filter, String skiptoken, Integer top, Metrictype metric, Context context); +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetailsKind.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetailsKind.java new file mode 100644 index 0000000000000..7f77f761d22c6 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetailsKind.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UsageDetailsKind. */ +public final class UsageDetailsKind extends ExpandableStringEnum { + /** Static value legacy for UsageDetailsKind. */ + public static final UsageDetailsKind LEGACY = fromString("legacy"); + + /** Static value modern for UsageDetailsKind. */ + public static final UsageDetailsKind MODERN = fromString("modern"); + + /** + * Creates or finds a UsageDetailsKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsageDetailsKind. + */ + @JsonCreator + public static UsageDetailsKind fromString(String name) { + return fromString(name, UsageDetailsKind.class); + } + + /** @return known UsageDetailsKind values. */ + public static Collection values() { + return values(UsageDetailsKind.class); + } +} diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetailsListResult.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetailsListResult.java new file mode 100644 index 0000000000000..928d9f1da0c31 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/UsageDetailsListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.consumption.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of listing usage details. It contains a list of available usage details in reverse chronological order by + * billing period. + */ +@Immutable +public final class UsageDetailsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageDetailsListResult.class); + + /* + * The list of usage details. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of usage details. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/package-info.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/package-info.java new file mode 100644 index 0000000000000..533ca7ef19324 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/models/package-info.java @@ -0,0 +1,9 @@ +// 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 ConsumptionManagementClient. Consumption management client provides access to + * consumption resources for Azure Enterprise Subscriptions. + */ +package com.azure.resourcemanager.consumption.models; diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/package-info.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/package-info.java new file mode 100644 index 0000000000000..b981ed0be5bc3 --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/package-info.java @@ -0,0 +1,9 @@ +// 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 ConsumptionManagementClient. Consumption management client provides access to + * consumption resources for Azure Enterprise Subscriptions. + */ +package com.azure.resourcemanager.consumption; diff --git a/sdk/consumption/azure-resourcemanager-consumption/src/main/java/module-info.java b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/module-info.java new file mode 100644 index 0000000000000..e5b5ff5af998b --- /dev/null +++ b/sdk/consumption/azure-resourcemanager-consumption/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.consumption { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.consumption; + exports com.azure.resourcemanager.consumption.fluent; + exports com.azure.resourcemanager.consumption.fluent.models; + exports com.azure.resourcemanager.consumption.models; + + opens com.azure.resourcemanager.consumption.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.consumption.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/consumption/ci.yml b/sdk/consumption/ci.yml new file mode 100644 index 0000000000000..3742bb1841c46 --- /dev/null +++ b/sdk/consumption/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/consumption/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/consumption/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: consumption + Artifacts: + - name: azure-resourcemanager-consumption + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerconsumption diff --git a/sdk/consumption/pom.xml b/sdk/consumption/pom.xml new file mode 100644 index 0000000000000..af2fbc1249d19 --- /dev/null +++ b/sdk/consumption/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-consumption-service + pom + 1.0.0 + + azure-resourcemanager-consumption + +