Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ReleasePR azure-resourcemanager-consumption] [Hub Generated] Review request for Microsoft.Consumption to add version stable/2023-11-01 #28509

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.4 (Unreleased)
## 1.0.0-beta.1 (2022-04-25)

- 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-2021-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-consumption</artifactId>
<version>1.0.0-beta.3</version>
<version>1.0.0-beta.4</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
62 changes: 62 additions & 0 deletions sdk/consumption/azure-resourcemanager-consumption/SAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@

- [ListByBillingAccount](#lotsoperation_listbybillingaccount)
- [ListByBillingProfile](#lotsoperation_listbybillingprofile)
- [ListByCustomer](#lotsoperation_listbycustomer)

## Marketplaces

- [List](#marketplaces_list)

## Operations

- [List](#operations_list)

## PriceSheet

- [Get](#pricesheet_get)
Expand Down Expand Up @@ -768,6 +773,42 @@ public final class LotsOperationListByBillingProfileSamples {
}
```

### LotsOperation_ListByCustomer

```java
import com.azure.core.util.Context;

/** Samples for LotsOperation ListByCustomer. */
public final class LotsOperationListByCustomerSamples {
/*
* x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByCustomer.json
*/
/**
* Sample code: LotsListByCustomer.
*
* @param manager Entry point to ConsumptionManager.
*/
public static void lotsListByCustomer(com.azure.resourcemanager.consumption.ConsumptionManager manager) {
manager.lotsOperations().listByCustomer("1234:5678", "1234:5678", null, Context.NONE);
}

/*
* x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByCustomerWithFilters.json
*/
/**
* Sample code: LotsListByCustomerWithFilter.
*
* @param manager Entry point to ConsumptionManager.
*/
public static void lotsListByCustomerWithFilter(com.azure.resourcemanager.consumption.ConsumptionManager manager) {
manager
.lotsOperations()
.listByCustomer(
"1234:5678", "1234:5678", "status eq 'active' AND source eq 'consumptioncommitment'", Context.NONE);
}
}
```

### Marketplaces_List

```java
Expand Down Expand Up @@ -921,6 +962,27 @@ public final class MarketplacesListSamples {
}
```

### Operations_List

```java
import com.azure.core.util.Context;

/** Samples for Operations List. */
public final class OperationsListSamples {
/*
* x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/OperationList.json
*/
/**
* Sample code: PriceSheetForBillingPeriod.
*
* @param manager Entry point to ConsumptionManager.
*/
public static void priceSheetForBillingPeriod(com.azure.resourcemanager.consumption.ConsumptionManager manager) {
manager.operations().list(Context.NONE);
}
}
```

### PriceSheet_Get

```java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
import com.azure.core.http.policy.RetryOptions;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
Expand Down Expand Up @@ -130,6 +132,19 @@ public static ConsumptionManager authenticate(TokenCredential credential, AzureP
return configure().authenticate(credential, profile);
}

/**
* Creates an instance of Consumption service API entry point.
*
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the Azure profile for client.
* @return the Consumption service API instance.
*/
public static ConsumptionManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new ConsumptionManager(httpPipeline, profile, null);
}

/**
* Gets a Configurable instance that can be used to create ConsumptionManager with optional configuration.
*
Expand All @@ -141,13 +156,14 @@ public static Configurable configure() {

/** The Configurable allowing configurations to be set. */
public static final class Configurable {
private final ClientLogger logger = new ClientLogger(Configurable.class);
private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);

private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
private final List<String> scopes = new ArrayList<>();
private RetryPolicy retryPolicy;
private RetryOptions retryOptions;
private Duration defaultPollInterval;

private Configurable() {
Expand Down Expand Up @@ -208,16 +224,31 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
return this;
}

/**
* Sets the retry options for the HTTP pipeline retry policy.
*
* <p>This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
*
* @param retryOptions the retry options for the HTTP pipeline retry policy.
* @return the configurable object itself.
*/
public Configurable withRetryOptions(RetryOptions retryOptions) {
this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
return this;
}

/**
* Sets the default poll interval, used when service does not provide "Retry-After" header.
*
* @param defaultPollInterval the default poll interval.
* @return the configurable object itself.
*/
public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null.");
this.defaultPollInterval =
Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null.");
if (this.defaultPollInterval.isNegative()) {
throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative"));
throw LOGGER
.logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative"));
}
return this;
}
Expand All @@ -239,7 +270,7 @@ public ConsumptionManager authenticate(TokenCredential credential, AzureProfile
.append("-")
.append("com.azure.resourcemanager.consumption")
.append("/")
.append("1.0.0-beta.3");
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
Expand All @@ -257,10 +288,15 @@ public ConsumptionManager authenticate(TokenCredential credential, AzureProfile
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
}
if (retryPolicy == null) {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
if (retryOptions != null) {
retryPolicy = new RetryPolicy(retryOptions);
} else {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
}
}
List<HttpPipelinePolicy> policies = new ArrayList<>();
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new AddHeadersFromContextPolicy());
policies.add(new RequestIdPolicy());
policies
.addAll(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface AggregatedCostsClient {
* @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.
* @return a management group aggregated cost resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<ManagementGroupAggregatedCostResultInner> getByManagementGroupWithResponse(
Expand Down Expand Up @@ -64,7 +64,7 @@ ManagementGroupAggregatedCostResultInner getForBillingPeriodByManagementGroup(
* @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.
* @return a management group aggregated cost resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<ManagementGroupAggregatedCostResultInner> getForBillingPeriodByManagementGroupWithResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface BalancesClient {
* @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.
* @return the balances for a scope by billingAccountId along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<BalanceInner> getByBillingAccountWithResponse(String billingAccountId, Context context);
Expand Down Expand Up @@ -63,7 +63,7 @@ public interface BalancesClient {
* @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.
* @return the balances for a scope by billing period and billingAccountId along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<BalanceInner> getForBillingPeriodByBillingAccountWithResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface BudgetsClient {
* @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.
* @return result of listing budgets as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<BudgetInner> list(String scope);
Expand All @@ -55,7 +55,7 @@ public interface BudgetsClient {
* @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.
* @return result of listing budgets as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<BudgetInner> list(String scope, Context context);
Expand Down Expand Up @@ -104,7 +104,7 @@ public interface BudgetsClient {
* @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.
* @return the budget for the scope by budget name along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<BudgetInner> getWithResponse(String scope, String budgetName, Context context);
Expand Down Expand Up @@ -159,7 +159,7 @@ public interface BudgetsClient {
* @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.
* @return a budget resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<BudgetInner> createOrUpdateWithResponse(
Expand Down Expand Up @@ -208,7 +208,7 @@ Response<BudgetInner> createOrUpdateWithResponse(
* @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.
* @return the {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> deleteWithResponse(String scope, String budgetName, Context context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public interface ChargesClient {
* @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.
* @return result of listing charge summary along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<ChargesListResultInner> listWithResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface CreditsClient {
* @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.
* @return a credit summary resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<CreditSummaryInner> getWithResponse(String billingAccountId, String billingProfileId, Context context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface EventsOperationsClient {
* @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.
* @return result of listing event summary as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<EventSummaryInner> listByBillingProfile(
Expand All @@ -41,7 +41,7 @@ PagedIterable<EventSummaryInner> listByBillingProfile(
* @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.
* @return result of listing event summary as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<EventSummaryInner> listByBillingProfile(
Expand All @@ -55,7 +55,7 @@ PagedIterable<EventSummaryInner> listByBillingProfile(
* @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.
* @return result of listing event summary as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<EventSummaryInner> listByBillingAccount(String billingAccountId);
Expand All @@ -72,7 +72,7 @@ PagedIterable<EventSummaryInner> listByBillingProfile(
* @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.
* @return result of listing event summary as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<EventSummaryInner> listByBillingAccount(String billingAccountId, String filter, Context context);
Expand Down
Loading