diff --git a/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md b/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md index 47fced0c8384..cc915093c975 100644 --- a/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md +++ b/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2021-09-17) +- Azure Resource Manager Billing client library for Java. This package contains Microsoft Azure SDK for Billing Management SDK. Billing client provides access to billing resources for Azure subscriptions. Package tag package-2020-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.1 (2021-04-13) diff --git a/sdk/billing/azure-resourcemanager-billing/README.md b/sdk/billing/azure-resourcemanager-billing/README.md index e97b320a839b..8882b0309397 100644 --- a/sdk/billing/azure-resourcemanager-billing/README.md +++ b/sdk/billing/azure-resourcemanager-billing/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-billing - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,8 @@ See [API design][design] for general introduction on design and key concepts on ## Examples + + ## Troubleshooting ## Next steps diff --git a/sdk/billing/azure-resourcemanager-billing/pom.xml b/sdk/billing/azure-resourcemanager-billing/pom.xml index e3593aa4613a..d2faa0419963 100644 --- a/sdk/billing/azure-resourcemanager-billing/pom.xml +++ b/sdk/billing/azure-resourcemanager-billing/pom.xml @@ -1,67 +1,86 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-billing - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-billing + 1.0.0-beta.2 + jar - Microsoft Azure SDK for Billing Management - This package contains Microsoft Azure SDK for Billing Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Billing client provides access to billing resources for Azure subscriptions. Package tag package-2020-05. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for Billing Management + This package contains Microsoft Azure SDK for Billing Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Billing client provides access to billing resources for Azure subscriptions. Package tag package-2020-05. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + 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 - 1.20.0 - - - com.azure - azure-core-management - 1.4.1 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.5 - - true - - - - + + 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 + 1.20.0 + + + com.azure + azure-core-management + 1.4.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java index 47fde74e9981..87ccda94f7e9 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java @@ -9,7 +9,6 @@ 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; @@ -17,6 +16,7 @@ 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.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -157,6 +157,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -196,6 +197,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { return this; } + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + /** * Sets the retry policy to the HTTP pipeline. * @@ -252,6 +264,9 @@ public BillingManager authenticate(TokenCredential credential, AzureProfile prof userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } @@ -261,10 +276,7 @@ public BillingManager authenticate(TokenCredential credential, AzureProfile prof HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java index 9aab5599b744..24aaa9766586 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java @@ -18,6 +18,7 @@ import com.azure.resourcemanager.billing.models.StatusReasonCode; import com.azure.resourcemanager.billing.models.TargetCloud; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map; @@ -135,6 +136,7 @@ public class BillingProfileInner extends ProxyResource { * Tags of billing profiles. */ @JsonProperty(value = "properties.tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java index 123ee76d91bd..37786ed0a8d2 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java @@ -13,6 +13,7 @@ import com.azure.resourcemanager.billing.models.Reseller; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; import java.util.UUID; /** A billing subscription. */ @@ -114,6 +115,13 @@ public class BillingSubscriptionInner extends ProxyResource { @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) private String skuDescription; + /* + * The suspension reason for a subscription. Applies only to subscriptions + * in Microsoft Online Services Program billing accounts. + */ + @JsonProperty(value = "properties.suspensionReasons", access = JsonProperty.Access.WRITE_ONLY) + private List suspensionReasons; + /** * Get the displayName property: The name of the subscription. * @@ -285,6 +293,16 @@ public String skuDescription() { return this.skuDescription; } + /** + * Get the suspensionReasons property: The suspension reason for a subscription. Applies only to subscriptions in + * Microsoft Online Services Program billing accounts. + * + * @return the suspensionReasons value. + */ + public List suspensionReasons() { + return this.suspensionReasons; + } + /** * Validates the instance. * diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java index ccfc25617326..2aee38d124ee 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java @@ -16,6 +16,7 @@ import com.azure.resourcemanager.billing.models.PaymentProperties; import com.azure.resourcemanager.billing.models.RebillDetails; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; @@ -163,6 +164,7 @@ public class InvoiceInner extends ProxyResource { * Rebill details for an invoice. */ @JsonProperty(value = "properties.rebillDetails", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map rebillDetails; /* diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java index 683a8e10f868..6f3b22e611ca 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java @@ -11,6 +11,7 @@ import com.azure.resourcemanager.billing.models.InvoiceSectionState; import com.azure.resourcemanager.billing.models.TargetCloud; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -30,6 +31,7 @@ public class InvoiceSectionInner extends ProxyResource { * Dictionary of metadata associated with the invoice section. */ @JsonProperty(value = "properties.labels") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map labels; /* @@ -44,6 +46,15 @@ public class InvoiceSectionInner extends ProxyResource { @JsonProperty(value = "properties.systemId", access = JsonProperty.Access.WRITE_ONLY) private String systemId; + /* + * Dictionary of metadata associated with the invoice section. Maximum + * key/value length supported of 256 characters. Keys/value should not + * empty value nor null. Keys can not contain < > % & \ ? / + */ + @JsonProperty(value = "properties.tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + /* * Identifies the cloud environments that are associated with an invoice * section. This is a system managed optional field and gets updated as the @@ -110,6 +121,30 @@ public String systemId() { return this.systemId; } + /** + * Get the tags property: Dictionary of metadata associated with the invoice section. Maximum key/value length + * supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ + * ? /. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Dictionary of metadata associated with the invoice section. Maximum key/value length + * supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ + * ? /. + * + * @param tags the tags value to set. + * @return the InvoiceSectionInner object itself. + */ + public InvoiceSectionInner withTags(Map tags) { + this.tags = tags; + return this; + } + /** * Get the targetCloud property: Identifies the cloud environments that are associated with an invoice section. This * is a system managed optional field and gets updated as the invoice section gets associated with accounts in diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java index 1cf7d5e610d1..4c0829954277 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java @@ -9,6 +9,8 @@ import com.azure.resourcemanager.billing.models.BillingSubscription; import com.azure.resourcemanager.billing.models.BillingSubscriptionStatusType; import com.azure.resourcemanager.billing.models.Reseller; +import java.util.Collections; +import java.util.List; import java.util.UUID; public final class BillingSubscriptionImpl implements BillingSubscription { @@ -94,6 +96,15 @@ public String skuDescription() { return this.innerModel().skuDescription(); } + public List suspensionReasons() { + List inner = this.innerModel().suspensionReasons(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + public BillingSubscriptionInner innerModel() { return this.innerObject; } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionImpl.java index 9acc5cdd1f6d..3015965629c0 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionImpl.java @@ -55,6 +55,15 @@ public String systemId() { return this.innerModel().systemId(); } + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + public TargetCloud targetCloud() { return this.innerModel().targetCloud(); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscription.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscription.java index f5c05a747766..c2943229bbc6 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscription.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscription.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.billing.models; import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; +import java.util.List; import java.util.UUID; /** An immutable client-side representation of BillingSubscription. */ @@ -137,6 +138,14 @@ public interface BillingSubscription { */ String skuDescription(); + /** + * Gets the suspensionReasons property: The suspension reason for a subscription. Applies only to subscriptions in + * Microsoft Online Services Program billing accounts. + * + * @return the suspensionReasons value. + */ + List suspensionReasons(); + /** * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner object. * diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSection.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSection.java index 134cbbd892ae..9c438923d556 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSection.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSection.java @@ -58,6 +58,15 @@ public interface InvoiceSection { */ String systemId(); + /** + * Gets the tags property: Dictionary of metadata associated with the invoice section. Maximum key/value length + * supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ + * ? /. + * + * @return the tags value. + */ + Map tags(); + /** * Gets the targetCloud property: Identifies the cloud environments that are associated with an invoice section. * This is a system managed optional field and gets updated as the invoice section gets associated with accounts in diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsListResult.java index 1d0be47d4080..e7a81b44a09e 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsListResult.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsListResult.java @@ -25,6 +25,12 @@ public final class ProductsListResult { @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; + /* + * Total number of records. + */ + @JsonProperty(value = "totalCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalCount; + /* * The link (url) to the next page of results. */ @@ -40,6 +46,15 @@ public List value() { return this.value; } + /** + * Get the totalCount property: Total number of records. + * + * @return the totalCount value. + */ + public Integer totalCount() { + return this.totalCount; + } + /** * Get the nextLink property: The link (url) to the next page of results. * diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/RebillDetails.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/RebillDetails.java index ff65fc0830b2..40b49bec98db 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/RebillDetails.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/RebillDetails.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -31,6 +32,7 @@ public final class RebillDetails { * Rebill details for an invoice. */ @JsonProperty(value = "rebillDetails", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map rebillDetails; /** diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionListResult.java index 78454f612843..45e11fd7eda1 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionListResult.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionListResult.java @@ -22,6 +22,12 @@ public final class TransactionListResult { @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; + /* + * Total number of records. + */ + @JsonProperty(value = "totalCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalCount; + /* * The link (url) to the next page of results. */ @@ -37,6 +43,15 @@ public List value() { return this.value; } + /** + * Get the totalCount property: Total number of records. + * + * @return the totalCount value. + */ + public Integer totalCount() { + return this.totalCount; + } + /** * Get the nextLink property: The link (url) to the next page of results. *