Skip to content

Commit

Permalink
CodeGen from PR 32829 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 71f659c9cf8bd36ecf5f77d612bd3b5651929f39 into b9300c96d19b7956716b57b1129d64240b268667
  • Loading branch information
SDKAuto committed Feb 26, 2025
1 parent 7c07a64 commit a4150e2
Show file tree
Hide file tree
Showing 120 changed files with 10,049 additions and 1,238 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.3 (Unreleased)
## 1.0.0-beta.1 (2025-02-26)

- Azure Resource Manager BillingBenefits client library for Java. This package contains Microsoft Azure SDK for BillingBenefits Management SDK. Azure Benefits RP let users create and manage benefits like savings plan. Package tag package-preview-2024-11-01-preview. 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 @@ -2,7 +2,7 @@

Azure Resource Manager BillingBenefits client library for Java.

This package contains Microsoft Azure SDK for BillingBenefits Management SDK. Azure Benefits RP let users create and manage benefits like savings plan. Package tag package-2022-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for BillingBenefits Management SDK. Azure Benefits RP let users create and manage benefits like savings plan. Package tag package-preview-2024-11-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## We'd love to hear your feedback

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-billingbenefits</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.3</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -52,15 +52,15 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment
Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code:

```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD);
TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
.build();
BillingBenefitsManager manager = BillingBenefitsManager
.authenticate(credential, profile);
```

The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise.
The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise.

See [Authentication][authenticate] for more options.

Expand Down Expand Up @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md
[coc]: https://opensource.microsoft.com/codeofconduct/
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/


521 changes: 492 additions & 29 deletions sdk/billingbenefits/azure-resourcemanager-billingbenefits/SAMPLE.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for BillingBenefits Management</name>
<description>This package contains Microsoft Azure SDK for BillingBenefits Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Benefits RP let users create and manage benefits like savings plan. Package tag package-2022-11-01.</description>
<description>This package contains Microsoft Azure SDK for BillingBenefits Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Benefits RP let users create and manage benefits like savings plan. Package tag package-preview-2024-11-01-preview.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down Expand Up @@ -46,6 +46,7 @@
<jacoco.min.linecoverage>0</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0</jacoco.min.branchcoverage>
<revapi.skip>true</revapi.skip>
<spotless.skip>false</spotless.skip>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
Expand All @@ -19,18 +20,22 @@
import com.azure.core.http.policy.RetryOptions;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.util.Configuration;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.billingbenefits.fluent.BillingBenefitsRP;
import com.azure.resourcemanager.billingbenefits.implementation.BillingBenefitsRPBuilder;
import com.azure.resourcemanager.billingbenefits.implementation.DiscountOperationsImpl;
import com.azure.resourcemanager.billingbenefits.implementation.DiscountsImpl;
import com.azure.resourcemanager.billingbenefits.implementation.OperationsImpl;
import com.azure.resourcemanager.billingbenefits.implementation.ReservationOrderAliasImpl;
import com.azure.resourcemanager.billingbenefits.implementation.ResourceProvidersImpl;
import com.azure.resourcemanager.billingbenefits.implementation.SavingsPlanOrderAliasImpl;
import com.azure.resourcemanager.billingbenefits.implementation.SavingsPlanOrdersImpl;
import com.azure.resourcemanager.billingbenefits.implementation.SavingsPlansImpl;
import com.azure.resourcemanager.billingbenefits.models.DiscountOperations;
import com.azure.resourcemanager.billingbenefits.models.Discounts;
import com.azure.resourcemanager.billingbenefits.models.Operations;
import com.azure.resourcemanager.billingbenefits.models.ReservationOrderAlias;
import com.azure.resourcemanager.billingbenefits.models.ResourceProviders;
Expand All @@ -41,6 +46,7 @@
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

Expand All @@ -61,13 +67,18 @@ public final class BillingBenefitsManager {

private ReservationOrderAlias reservationOrderAlias;

private Discounts discounts;

private DiscountOperations discountOperations;

private final BillingBenefitsRP clientObject;

private BillingBenefitsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
this.clientObject = new BillingBenefitsRPBuilder().pipeline(httpPipeline)
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval)
.buildClient();
}
Expand Down Expand Up @@ -112,6 +123,9 @@ public static Configurable configure() {
*/
public static final class Configurable {
private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);
private static final String SDK_VERSION = "version";
private static final Map<String, String> PROPERTIES
= CoreUtils.getProperties("azure-resourcemanager-billingbenefits.properties");

private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
Expand Down Expand Up @@ -219,12 +233,14 @@ public BillingBenefitsManager authenticate(TokenCredential credential, AzureProf
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");

String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion");

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder.append("azsdk-java")
.append("-")
.append("com.azure.resourcemanager.billingbenefits")
.append("/")
.append("1.0.0-beta.2");
.append(clientVersion);
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
Expand Down Expand Up @@ -257,7 +273,7 @@ public BillingBenefitsManager authenticate(TokenCredential credential, AzureProf
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
Expand Down Expand Up @@ -342,6 +358,30 @@ public ReservationOrderAlias reservationOrderAlias() {
return reservationOrderAlias;
}

/**
* Gets the resource collection API of Discounts. It manages Discount.
*
* @return Resource collection API of Discounts.
*/
public Discounts discounts() {
if (this.discounts == null) {
this.discounts = new DiscountsImpl(clientObject.getDiscounts(), this);
}
return discounts;
}

/**
* Gets the resource collection API of DiscountOperations.
*
* @return Resource collection API of DiscountOperations.
*/
public DiscountOperations discountOperations() {
if (this.discountOperations == null) {
this.discountOperations = new DiscountOperationsImpl(clientObject.getDiscountOperations(), this);
}
return discountOperations;
}

/**
* Gets wrapped service client BillingBenefitsRP providing direct access to the underlying auto-generated API
* implementation, based on Azure REST API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
* The interface for BillingBenefitsRP class.
*/
public interface BillingBenefitsRP {
/**
* Gets The ID of the target subscription. The value must be an UUID.
*
* @return the subscriptionId value.
*/
String getSubscriptionId();

/**
* Gets server parameter.
*
Expand Down Expand Up @@ -80,4 +87,18 @@ public interface BillingBenefitsRP {
* @return the ReservationOrderAliasClient object.
*/
ReservationOrderAliasClient getReservationOrderAlias();

/**
* Gets the DiscountsClient object to access its operations.
*
* @return the DiscountsClient object.
*/
DiscountsClient getDiscounts();

/**
* Gets the DiscountOperationsClient object to access its operations.
*
* @return the DiscountOperationsClient object.
*/
DiscountOperationsClient getDiscountOperations();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.billingbenefits.fluent;

import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.Response;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.billingbenefits.fluent.models.DiscountInner;
import com.azure.resourcemanager.billingbenefits.models.DiscountPatchRequest;

/**
* An instance of this class provides access to all the operations defined in DiscountOperationsClient.
*/
public interface DiscountOperationsClient {
/**
* Get discount at resource group level.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param discountName Name of the discount.
* @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 discount at resource group level along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<DiscountInner> getByResourceGroupWithResponse(String resourceGroupName, String discountName,
Context context);

/**
* Get discount at resource group level.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param discountName Name of the discount.
* @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 discount at resource group level.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
DiscountInner getByResourceGroup(String resourceGroupName, String discountName);

/**
* Update discounts.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param discountName Name of the discount.
* @param body Request body for updating discounts.
* @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 {@link SyncPoller} for polling of resource definition for Discounts.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<DiscountInner>, DiscountInner> beginUpdate(String resourceGroupName, String discountName,
DiscountPatchRequest body);

/**
* Update discounts.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param discountName Name of the discount.
* @param body Request body for updating discounts.
* @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 {@link SyncPoller} for polling of resource definition for Discounts.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<DiscountInner>, DiscountInner> beginUpdate(String resourceGroupName, String discountName,
DiscountPatchRequest body, Context context);

/**
* Update discounts.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param discountName Name of the discount.
* @param body Request body for updating discounts.
* @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 resource definition for Discounts.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
DiscountInner update(String resourceGroupName, String discountName, DiscountPatchRequest body);

/**
* Update discounts.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param discountName Name of the discount.
* @param body Request body for updating discounts.
* @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 resource definition for Discounts.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
DiscountInner update(String resourceGroupName, String discountName, DiscountPatchRequest body, Context context);
}
Loading

0 comments on commit a4150e2

Please sign in to comment.