Skip to content

[AutoPR azure-resourcemanager-billing] Removed locale from request body #15321

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 2 additions & 8 deletions sdk/billing/azure-resourcemanager-billing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Release History

## 1.1.0-beta.1 (Unreleased)
## 1.0.0-beta.1 (2025-05-13)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
- Azure Resource Manager Billing client library for Java. This package contains Microsoft Azure SDK for Billing Management SDK. Billing Client. Package tag package-2024-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## 1.0.0 (2024-09-05)

Expand Down
6 changes: 2 additions & 4 deletions sdk/billing/azure-resourcemanager-billing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
BillingManager manager = BillingManager
.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/


5,058 changes: 2,529 additions & 2,529 deletions sdk/billing/azure-resourcemanager-billing/SAMPLE.md

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions sdk/billing/azure-resourcemanager-billing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco.min.linecoverage>0</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0</jacoco.min.branchcoverage>
<revapi.skip>true</revapi.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.5.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
Expand All @@ -62,6 +58,11 @@
<artifactId>azure-core-management</artifactId>
<version>1.17.0</version> <!-- {x-version-update;com.azure:azure-core-management;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.5.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@
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.HttpLoggingPolicy;
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.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.billing.fluent.BillingManagementClient;
import com.azure.resourcemanager.billing.implementation.AddressImpl;
Expand Down Expand Up @@ -71,8 +72,8 @@
import com.azure.resourcemanager.billing.models.Customers;
import com.azure.resourcemanager.billing.models.Departments;
import com.azure.resourcemanager.billing.models.EnrollmentAccounts;
import com.azure.resourcemanager.billing.models.Invoices;
import com.azure.resourcemanager.billing.models.InvoiceSections;
import com.azure.resourcemanager.billing.models.Invoices;
import com.azure.resourcemanager.billing.models.Operations;
import com.azure.resourcemanager.billing.models.PartnerTransfers;
import com.azure.resourcemanager.billing.models.PaymentMethods;
Expand All @@ -89,6 +90,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 Down Expand Up @@ -209,6 +211,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-billing.properties");

private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
Expand Down Expand Up @@ -316,12 +321,14 @@ public BillingManager authenticate(TokenCredential credential, AzureProfile prof
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.billing")
.append("/")
.append("1.0.0");
.append(clientVersion);
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
Expand Down Expand Up @@ -354,7 +361,7 @@ public BillingManager authenticate(TokenCredential credential, AzureProfile prof
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
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public NextBillingCycleDetails nextBillingCycleDetails() {

/**
* Get the offerId property: The offer ID for the subscription. This field is only available for the Microsoft
* Online Services Program billing accounts.
* Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement.
*
* @return the offerId value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final class BillingSubscriptionAliasProperties extends BillingSubscriptio

/*
* The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing
* accounts.
* accounts or billing accounts with agreement type Enterprise Agreement.
*/
private String offerId;

Expand Down Expand Up @@ -367,7 +367,7 @@ public String productCategory() {

/**
* Get the offerId property: The offer ID for the subscription. This field is only available for the Microsoft
* Online Services Program billing accounts.
* Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement.
*
* @return the offerId value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public NextBillingCycleDetails nextBillingCycleDetails() {

/**
* Get the offerId property: The offer ID for the subscription. This field is only available for the Microsoft
* Online Services Program billing accounts.
* Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement.
*
* @return the offerId value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public class BillingSubscriptionProperties implements JsonSerializable<BillingSu

/*
* The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing
* accounts.
* accounts or billing accounts with agreement type Enterprise Agreement.
*/
private String offerId;

Expand Down Expand Up @@ -727,7 +727,7 @@ BillingSubscriptionProperties withNextBillingCycleDetails(NextBillingCycleDetail

/**
* Get the offerId property: The offer ID for the subscription. This field is only available for the Microsoft
* Online Services Program billing accounts.
* Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement.
*
* @return the offerId value.
*/
Expand All @@ -737,7 +737,7 @@ public String offerId() {

/**
* Set the offerId property: The offer ID for the subscription. This field is only available for the Microsoft
* Online Services Program billing accounts.
* Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement.
*
* @param offerId the offerId value to set.
* @return the BillingSubscriptionProperties object itself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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.billing.fluent.AddressClient;
import com.azure.resourcemanager.billing.fluent.models.AddressValidationResponseInner;
import com.azure.resourcemanager.billing.models.AddressDetails;
Expand Down Expand Up @@ -64,6 +65,14 @@ public interface AddressService {
Mono<Response<AddressValidationResponseInner>> validate(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @BodyParam("application/json") AddressDetails parameters,
@HeaderParam("Accept") String accept, Context context);

@Headers({ "Content-Type: application/json" })
@Post("/providers/Microsoft.Billing/validateAddress")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Response<AddressValidationResponseInner> validateSync(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @BodyParam("application/json") AddressDetails parameters,
@HeaderParam("Accept") String accept, Context context);
}

/**
Expand Down Expand Up @@ -93,33 +102,6 @@ private Mono<Response<AddressValidationResponseInner>> validateWithResponseAsync
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}

/**
* Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address.
*
* @param parameters Address details.
* @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 the address validation along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<AddressValidationResponseInner>> validateWithResponseAsync(AddressDetails parameters,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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.validate(this.client.getEndpoint(), this.client.getApiVersion(), parameters, accept, context);
}

/**
* Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address.
*
Expand All @@ -146,7 +128,20 @@ private Mono<AddressValidationResponseInner> validateAsync(AddressDetails parame
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<AddressValidationResponseInner> validateWithResponse(AddressDetails parameters, Context context) {
return validateWithResponseAsync(parameters, context).block();
if (this.client.getEndpoint() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (parameters == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return service.validateSync(this.client.getEndpoint(), this.client.getApiVersion(), parameters, accept,
context);
}

/**
Expand All @@ -162,4 +157,6 @@ public Response<AddressValidationResponseInner> validateWithResponse(AddressDeta
public AddressValidationResponseInner validate(AddressDetails parameters) {
return validateWithResponse(parameters, Context.NONE).getValue();
}

private static final ClientLogger LOGGER = new ClientLogger(AddressClientImpl.class);
}
Loading