Skip to content

Commit d3ea850

Browse files
author
SDKAuto
committed
CodeGen from PR 33456 in Azure/azure-rest-api-specs
Merge f7ecbda47cca50e78dfef5457ba1f293bc971f23 into 9b3e29902644a7bb9317d68f249c7cb8b11d82cf
1 parent 24edb14 commit d3ea850

File tree

120 files changed

+10049
-1237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+10049
-1237
lines changed

sdk/billingbenefits/azure-resourcemanager-billingbenefits/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Release History
22

3-
## 1.0.0-beta.3 (Unreleased)
3+
## 1.0.0-beta.1 (2025-03-24)
4+
5+
- 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).
46

57
### Features Added
68

sdk/billingbenefits/azure-resourcemanager-billingbenefits/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Azure Resource Manager BillingBenefits client library for Java.
44

5-
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).
5+
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).
66

77
## We'd love to hear your feedback
88

@@ -52,15 +52,15 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment
5252
Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code:
5353

5454
```java
55-
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
55+
AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD);
5656
TokenCredential credential = new DefaultAzureCredentialBuilder()
5757
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
5858
.build();
5959
BillingBenefitsManager manager = BillingBenefitsManager
6060
.authenticate(credential, profile);
6161
```
6262

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

6565
See [Authentication][authenticate] for more options.
6666

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

sdk/billingbenefits/azure-resourcemanager-billingbenefits/SAMPLE.md

Lines changed: 492 additions & 29 deletions
Large diffs are not rendered by default.

sdk/billingbenefits/azure-resourcemanager-billingbenefits/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<packaging>jar</packaging>
1919

2020
<name>Microsoft Azure SDK for BillingBenefits Management</name>
21-
<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>
21+
<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>
2222
<url>https://github.com/Azure/azure-sdk-for-java</url>
2323

2424
<licenses>
@@ -46,6 +46,7 @@
4646
<jacoco.min.linecoverage>0</jacoco.min.linecoverage>
4747
<jacoco.min.branchcoverage>0</jacoco.min.branchcoverage>
4848
<revapi.skip>true</revapi.skip>
49+
<spotless.skip>false</spotless.skip>
4950
</properties>
5051
<dependencies>
5152
<dependency>

sdk/billingbenefits/azure-resourcemanager-billingbenefits/src/main/java/com/azure/resourcemanager/billingbenefits/BillingBenefitsManager.java

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.azure.core.http.HttpPipelinePosition;
1212
import com.azure.core.http.policy.AddDatePolicy;
1313
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
14+
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
1415
import com.azure.core.http.policy.HttpLogOptions;
1516
import com.azure.core.http.policy.HttpLoggingPolicy;
1617
import com.azure.core.http.policy.HttpPipelinePolicy;
@@ -19,18 +20,22 @@
1920
import com.azure.core.http.policy.RetryOptions;
2021
import com.azure.core.http.policy.RetryPolicy;
2122
import com.azure.core.http.policy.UserAgentPolicy;
22-
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
2323
import com.azure.core.management.profile.AzureProfile;
2424
import com.azure.core.util.Configuration;
25+
import com.azure.core.util.CoreUtils;
2526
import com.azure.core.util.logging.ClientLogger;
2627
import com.azure.resourcemanager.billingbenefits.fluent.BillingBenefitsRP;
2728
import com.azure.resourcemanager.billingbenefits.implementation.BillingBenefitsRPBuilder;
29+
import com.azure.resourcemanager.billingbenefits.implementation.DiscountOperationsImpl;
30+
import com.azure.resourcemanager.billingbenefits.implementation.DiscountsImpl;
2831
import com.azure.resourcemanager.billingbenefits.implementation.OperationsImpl;
2932
import com.azure.resourcemanager.billingbenefits.implementation.ReservationOrderAliasImpl;
3033
import com.azure.resourcemanager.billingbenefits.implementation.ResourceProvidersImpl;
3134
import com.azure.resourcemanager.billingbenefits.implementation.SavingsPlanOrderAliasImpl;
3235
import com.azure.resourcemanager.billingbenefits.implementation.SavingsPlanOrdersImpl;
3336
import com.azure.resourcemanager.billingbenefits.implementation.SavingsPlansImpl;
37+
import com.azure.resourcemanager.billingbenefits.models.DiscountOperations;
38+
import com.azure.resourcemanager.billingbenefits.models.Discounts;
3439
import com.azure.resourcemanager.billingbenefits.models.Operations;
3540
import com.azure.resourcemanager.billingbenefits.models.ReservationOrderAlias;
3641
import com.azure.resourcemanager.billingbenefits.models.ResourceProviders;
@@ -41,6 +46,7 @@
4146
import java.time.temporal.ChronoUnit;
4247
import java.util.ArrayList;
4348
import java.util.List;
49+
import java.util.Map;
4450
import java.util.Objects;
4551
import java.util.stream.Collectors;
4652

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

6268
private ReservationOrderAlias reservationOrderAlias;
6369

70+
private Discounts discounts;
71+
72+
private DiscountOperations discountOperations;
73+
6474
private final BillingBenefitsRP clientObject;
6575

6676
private BillingBenefitsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) {
6777
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
6878
Objects.requireNonNull(profile, "'profile' cannot be null.");
6979
this.clientObject = new BillingBenefitsRPBuilder().pipeline(httpPipeline)
7080
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
81+
.subscriptionId(profile.getSubscriptionId())
7182
.defaultPollInterval(defaultPollInterval)
7283
.buildClient();
7384
}
@@ -112,6 +123,9 @@ public static Configurable configure() {
112123
*/
113124
public static final class Configurable {
114125
private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);
126+
private static final String SDK_VERSION = "version";
127+
private static final Map<String, String> PROPERTIES
128+
= CoreUtils.getProperties("azure-resourcemanager-billingbenefits.properties");
115129

116130
private HttpClient httpClient;
117131
private HttpLogOptions httpLogOptions;
@@ -219,12 +233,14 @@ public BillingBenefitsManager authenticate(TokenCredential credential, AzureProf
219233
Objects.requireNonNull(credential, "'credential' cannot be null.");
220234
Objects.requireNonNull(profile, "'profile' cannot be null.");
221235

236+
String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion");
237+
222238
StringBuilder userAgentBuilder = new StringBuilder();
223239
userAgentBuilder.append("azsdk-java")
224240
.append("-")
225241
.append("com.azure.resourcemanager.billingbenefits")
226242
.append("/")
227-
.append("1.0.0-beta.2");
243+
.append(clientVersion);
228244
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
229245
userAgentBuilder.append(" (")
230246
.append(Configuration.getGlobalConfiguration().get("java.version"))
@@ -257,7 +273,7 @@ public BillingBenefitsManager authenticate(TokenCredential credential, AzureProf
257273
HttpPolicyProviders.addBeforeRetryPolicies(policies);
258274
policies.add(retryPolicy);
259275
policies.add(new AddDatePolicy());
260-
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
276+
policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0])));
261277
policies.addAll(this.policies.stream()
262278
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
263279
.collect(Collectors.toList()));
@@ -342,6 +358,30 @@ public ReservationOrderAlias reservationOrderAlias() {
342358
return reservationOrderAlias;
343359
}
344360

361+
/**
362+
* Gets the resource collection API of Discounts. It manages Discount.
363+
*
364+
* @return Resource collection API of Discounts.
365+
*/
366+
public Discounts discounts() {
367+
if (this.discounts == null) {
368+
this.discounts = new DiscountsImpl(clientObject.getDiscounts(), this);
369+
}
370+
return discounts;
371+
}
372+
373+
/**
374+
* Gets the resource collection API of DiscountOperations.
375+
*
376+
* @return Resource collection API of DiscountOperations.
377+
*/
378+
public DiscountOperations discountOperations() {
379+
if (this.discountOperations == null) {
380+
this.discountOperations = new DiscountOperationsImpl(clientObject.getDiscountOperations(), this);
381+
}
382+
return discountOperations;
383+
}
384+
345385
/**
346386
* Gets wrapped service client BillingBenefitsRP providing direct access to the underlying auto-generated API
347387
* implementation, based on Azure REST API.

sdk/billingbenefits/azure-resourcemanager-billingbenefits/src/main/java/com/azure/resourcemanager/billingbenefits/fluent/BillingBenefitsRP.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
* The interface for BillingBenefitsRP class.
1212
*/
1313
public interface BillingBenefitsRP {
14+
/**
15+
* Gets The ID of the target subscription. The value must be an UUID.
16+
*
17+
* @return the subscriptionId value.
18+
*/
19+
String getSubscriptionId();
20+
1421
/**
1522
* Gets server parameter.
1623
*
@@ -80,4 +87,18 @@ public interface BillingBenefitsRP {
8087
* @return the ReservationOrderAliasClient object.
8188
*/
8289
ReservationOrderAliasClient getReservationOrderAlias();
90+
91+
/**
92+
* Gets the DiscountsClient object to access its operations.
93+
*
94+
* @return the DiscountsClient object.
95+
*/
96+
DiscountsClient getDiscounts();
97+
98+
/**
99+
* Gets the DiscountOperationsClient object to access its operations.
100+
*
101+
* @return the DiscountOperationsClient object.
102+
*/
103+
DiscountOperationsClient getDiscountOperations();
83104
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
5+
package com.azure.resourcemanager.billingbenefits.fluent;
6+
7+
import com.azure.core.annotation.ReturnType;
8+
import com.azure.core.annotation.ServiceMethod;
9+
import com.azure.core.http.rest.Response;
10+
import com.azure.core.management.polling.PollResult;
11+
import com.azure.core.util.Context;
12+
import com.azure.core.util.polling.SyncPoller;
13+
import com.azure.resourcemanager.billingbenefits.fluent.models.DiscountInner;
14+
import com.azure.resourcemanager.billingbenefits.models.DiscountPatchRequest;
15+
16+
/**
17+
* An instance of this class provides access to all the operations defined in DiscountOperationsClient.
18+
*/
19+
public interface DiscountOperationsClient {
20+
/**
21+
* Get discount at resource group level.
22+
*
23+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
24+
* @param discountName Name of the discount.
25+
* @param context The context to associate with this operation.
26+
* @throws IllegalArgumentException thrown if parameters fail the validation.
27+
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
28+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
29+
* @return discount at resource group level along with {@link Response}.
30+
*/
31+
@ServiceMethod(returns = ReturnType.SINGLE)
32+
Response<DiscountInner> getByResourceGroupWithResponse(String resourceGroupName, String discountName,
33+
Context context);
34+
35+
/**
36+
* Get discount at resource group level.
37+
*
38+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
39+
* @param discountName Name of the discount.
40+
* @throws IllegalArgumentException thrown if parameters fail the validation.
41+
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
42+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
43+
* @return discount at resource group level.
44+
*/
45+
@ServiceMethod(returns = ReturnType.SINGLE)
46+
DiscountInner getByResourceGroup(String resourceGroupName, String discountName);
47+
48+
/**
49+
* Update discounts.
50+
*
51+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
52+
* @param discountName Name of the discount.
53+
* @param body Request body for updating discounts.
54+
* @throws IllegalArgumentException thrown if parameters fail the validation.
55+
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
56+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
57+
* @return the {@link SyncPoller} for polling of resource definition for Discounts.
58+
*/
59+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
60+
SyncPoller<PollResult<DiscountInner>, DiscountInner> beginUpdate(String resourceGroupName, String discountName,
61+
DiscountPatchRequest body);
62+
63+
/**
64+
* Update discounts.
65+
*
66+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
67+
* @param discountName Name of the discount.
68+
* @param body Request body for updating discounts.
69+
* @param context The context to associate with this operation.
70+
* @throws IllegalArgumentException thrown if parameters fail the validation.
71+
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
72+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
73+
* @return the {@link SyncPoller} for polling of resource definition for Discounts.
74+
*/
75+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
76+
SyncPoller<PollResult<DiscountInner>, DiscountInner> beginUpdate(String resourceGroupName, String discountName,
77+
DiscountPatchRequest body, Context context);
78+
79+
/**
80+
* Update discounts.
81+
*
82+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
83+
* @param discountName Name of the discount.
84+
* @param body Request body for updating discounts.
85+
* @throws IllegalArgumentException thrown if parameters fail the validation.
86+
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
87+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
88+
* @return resource definition for Discounts.
89+
*/
90+
@ServiceMethod(returns = ReturnType.SINGLE)
91+
DiscountInner update(String resourceGroupName, String discountName, DiscountPatchRequest body);
92+
93+
/**
94+
* Update discounts.
95+
*
96+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
97+
* @param discountName Name of the discount.
98+
* @param body Request body for updating discounts.
99+
* @param context The context to associate with this operation.
100+
* @throws IllegalArgumentException thrown if parameters fail the validation.
101+
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
102+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
103+
* @return resource definition for Discounts.
104+
*/
105+
@ServiceMethod(returns = ReturnType.SINGLE)
106+
DiscountInner update(String resourceGroupName, String discountName, DiscountPatchRequest body, Context context);
107+
}

0 commit comments

Comments
 (0)