Skip to content

Commit 4d505c2

Browse files
author
SDKAuto
committed
CodeGen from PR 15886 in Azure/azure-rest-api-specs
Merge 4c013647b8d6a6bf77e1ec65ac50efbf3b7a3539 into 0f91e50e838e33c9fe866f898a1fe7d558eb1779
1 parent 2f352fc commit 4d505c2

File tree

15 files changed

+229
-68
lines changed

15 files changed

+229
-68
lines changed

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

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

3-
## 1.0.0-beta.2 (Unreleased)
3+
## 1.0.0-beta.1 (2021-09-17)
44

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

67
## 1.0.0-beta.1 (2021-04-13)
78

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Various documentation is available to help you get started
3232
<dependency>
3333
<groupId>com.azure.resourcemanager</groupId>
3434
<artifactId>azure-resourcemanager-billing</artifactId>
35-
<version>1.0.0-beta.1</version>
35+
<version>1.0.0-beta.2</version>
3636
</dependency>
3737
```
3838
[//]: # ({x-version-update-end})
@@ -74,6 +74,8 @@ See [API design][design] for general introduction on design and key concepts on
7474

7575
## Examples
7676

77+
78+
7779
## Troubleshooting
7880

7981
## Next steps
Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,86 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2-
<modelVersion>4.0.0</modelVersion>
3-
<parent>
4-
<groupId>com.azure</groupId>
5-
<artifactId>azure-client-sdk-parent</artifactId>
6-
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
7-
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
8-
</parent>
2+
<modelVersion>4.0.0</modelVersion>
3+
<parent>
4+
<groupId>com.azure</groupId>
5+
<artifactId>azure-client-sdk-parent</artifactId>
6+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
7+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
8+
</parent>
99

10-
<groupId>com.azure.resourcemanager</groupId>
11-
<artifactId>azure-resourcemanager-billing</artifactId>
12-
<version>1.0.0-beta.2</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-billing;current} -->
13-
<packaging>jar</packaging>
10+
<groupId>com.azure.resourcemanager</groupId>
11+
<artifactId>azure-resourcemanager-billing</artifactId>
12+
<version>1.0.0-beta.2</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-billing;current} -->
13+
<packaging>jar</packaging>
1414

15-
<name>Microsoft Azure SDK for Billing Management</name>
16-
<description>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.</description>
17-
<url>https://github.com/Azure/azure-sdk-for-java</url>
15+
<name>Microsoft Azure SDK for Billing Management</name>
16+
<description>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.</description>
17+
<url>https://github.com/Azure/azure-sdk-for-java</url>
1818

19-
<licenses>
20-
<license>
21-
<name>The MIT License (MIT)</name>
22-
<url>http://opensource.org/licenses/MIT</url>
23-
<distribution>repo</distribution>
24-
</license>
25-
</licenses>
19+
<licenses>
20+
<license>
21+
<name>The MIT License (MIT)</name>
22+
<url>http://opensource.org/licenses/MIT</url>
23+
<distribution>repo</distribution>
24+
</license>
25+
</licenses>
2626

27-
<scm>
28-
<url>https://github.com/Azure/azure-sdk-for-java</url>
29-
<connection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</connection>
30-
<developerConnection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</developerConnection>
31-
<tag>HEAD</tag>
32-
</scm>
33-
<developers>
34-
<developer>
35-
<id>microsoft</id>
36-
<name>Microsoft</name>
37-
</developer>
38-
</developers>
39-
<properties>
40-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
41-
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
42-
</properties>
43-
<dependencies>
44-
<dependency>
45-
<groupId>com.azure</groupId>
46-
<artifactId>azure-core</artifactId>
47-
<version>1.20.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
48-
</dependency>
49-
<dependency>
50-
<groupId>com.azure</groupId>
51-
<artifactId>azure-core-management</artifactId>
52-
<version>1.4.1</version> <!-- {x-version-update;com.azure:azure-core-management;dependency} -->
53-
</dependency>
54-
</dependencies>
55-
<build>
56-
<plugins>
57-
<plugin>
58-
<groupId>org.jacoco</groupId>
59-
<artifactId>jacoco-maven-plugin</artifactId>
60-
<version>0.8.5</version> <!-- {x-version-update;org.jacoco:jacoco-maven-plugin;external_dependency} -->
61-
<configuration>
62-
<skip>true</skip>
63-
</configuration>
64-
</plugin>
65-
</plugins>
66-
</build>
27+
<scm>
28+
<url>https://github.com/Azure/azure-sdk-for-java</url>
29+
<connection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</connection>
30+
<developerConnection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</developerConnection>
31+
<tag>HEAD</tag>
32+
</scm>
33+
<developers>
34+
<developer>
35+
<id>microsoft</id>
36+
<name>Microsoft</name>
37+
</developer>
38+
</developers>
39+
<properties>
40+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
41+
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
42+
</properties>
43+
<dependencies>
44+
<dependency>
45+
<groupId>com.azure</groupId>
46+
<artifactId>azure-core</artifactId>
47+
<version>1.20.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
48+
</dependency>
49+
<dependency>
50+
<groupId>com.azure</groupId>
51+
<artifactId>azure-core-management</artifactId>
52+
<version>1.4.1</version> <!-- {x-version-update;com.azure:azure-core-management;dependency} -->
53+
</dependency>
54+
</dependencies>
55+
<build>
56+
<plugins>
57+
<plugin>
58+
<groupId>org.jacoco</groupId>
59+
<artifactId>jacoco-maven-plugin</artifactId>
60+
<version>0.8.5</version> <!-- {x-version-update;org.jacoco:jacoco-maven-plugin;external_dependency} -->
61+
<configuration>
62+
<skip>true</skip>
63+
</configuration>
64+
</plugin>
65+
<plugin>
66+
<groupId>org.revapi</groupId>
67+
<artifactId>revapi-maven-plugin</artifactId>
68+
<version>0.11.2</version> <!-- {x-version-update;org.revapi:revapi-maven-plugin;external_dependency} -->
69+
<configuration>
70+
<analysisConfiguration>
71+
<revapi.ignore>
72+
<item>
73+
<code>java.method.addedToInterface</code>
74+
</item>
75+
<item>
76+
<regex>true</regex>
77+
<code>.*</code>
78+
<package>com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)*</package>
79+
</item>
80+
</revapi.ignore>
81+
</analysisConfiguration>
82+
</configuration>
83+
</plugin>
84+
</plugins>
85+
</build>
6786
</project>

sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import com.azure.core.http.HttpPipeline;
1010
import com.azure.core.http.HttpPipelineBuilder;
1111
import com.azure.core.http.policy.AddDatePolicy;
12-
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
1312
import com.azure.core.http.policy.HttpLogOptions;
1413
import com.azure.core.http.policy.HttpLoggingPolicy;
1514
import com.azure.core.http.policy.HttpPipelinePolicy;
1615
import com.azure.core.http.policy.HttpPolicyProviders;
1716
import com.azure.core.http.policy.RequestIdPolicy;
1817
import com.azure.core.http.policy.RetryPolicy;
1918
import com.azure.core.http.policy.UserAgentPolicy;
19+
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
2020
import com.azure.core.management.profile.AzureProfile;
2121
import com.azure.core.util.Configuration;
2222
import com.azure.core.util.logging.ClientLogger;
@@ -157,6 +157,7 @@ public static final class Configurable {
157157
private HttpClient httpClient;
158158
private HttpLogOptions httpLogOptions;
159159
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
160+
private final List<String> scopes = new ArrayList<>();
160161
private RetryPolicy retryPolicy;
161162
private Duration defaultPollInterval;
162163

@@ -196,6 +197,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) {
196197
return this;
197198
}
198199

200+
/**
201+
* Adds the scope to permission sets.
202+
*
203+
* @param scope the scope.
204+
* @return the configurable object itself.
205+
*/
206+
public Configurable withScope(String scope) {
207+
this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
208+
return this;
209+
}
210+
199211
/**
200212
* Sets the retry policy to the HTTP pipeline.
201213
*
@@ -252,6 +264,9 @@ public BillingManager authenticate(TokenCredential credential, AzureProfile prof
252264
userAgentBuilder.append(" (auto-generated)");
253265
}
254266

267+
if (scopes.isEmpty()) {
268+
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
269+
}
255270
if (retryPolicy == null) {
256271
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
257272
}
@@ -261,10 +276,7 @@ public BillingManager authenticate(TokenCredential credential, AzureProfile prof
261276
HttpPolicyProviders.addBeforeRetryPolicies(policies);
262277
policies.add(retryPolicy);
263278
policies.add(new AddDatePolicy());
264-
policies
265-
.add(
266-
new BearerTokenAuthenticationPolicy(
267-
credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
279+
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
268280
policies.addAll(this.policies);
269281
HttpPolicyProviders.addAfterRetryPolicies(policies);
270282
policies.add(new HttpLoggingPolicy(httpLogOptions));

sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.azure.resourcemanager.billing.models.StatusReasonCode;
1919
import com.azure.resourcemanager.billing.models.TargetCloud;
2020
import com.fasterxml.jackson.annotation.JsonIgnore;
21+
import com.fasterxml.jackson.annotation.JsonInclude;
2122
import com.fasterxml.jackson.annotation.JsonProperty;
2223
import java.util.List;
2324
import java.util.Map;
@@ -135,6 +136,7 @@ public class BillingProfileInner extends ProxyResource {
135136
* Tags of billing profiles.
136137
*/
137138
@JsonProperty(value = "properties.tags")
139+
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
138140
private Map<String, String> tags;
139141

140142
/**

sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.azure.resourcemanager.billing.models.Reseller;
1414
import com.fasterxml.jackson.annotation.JsonIgnore;
1515
import com.fasterxml.jackson.annotation.JsonProperty;
16+
import java.util.List;
1617
import java.util.UUID;
1718

1819
/** A billing subscription. */
@@ -114,6 +115,13 @@ public class BillingSubscriptionInner extends ProxyResource {
114115
@JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY)
115116
private String skuDescription;
116117

118+
/*
119+
* The suspension reason for a subscription. Applies only to subscriptions
120+
* in Microsoft Online Services Program billing accounts.
121+
*/
122+
@JsonProperty(value = "properties.suspensionReasons", access = JsonProperty.Access.WRITE_ONLY)
123+
private List<String> suspensionReasons;
124+
117125
/**
118126
* Get the displayName property: The name of the subscription.
119127
*
@@ -285,6 +293,16 @@ public String skuDescription() {
285293
return this.skuDescription;
286294
}
287295

296+
/**
297+
* Get the suspensionReasons property: The suspension reason for a subscription. Applies only to subscriptions in
298+
* Microsoft Online Services Program billing accounts.
299+
*
300+
* @return the suspensionReasons value.
301+
*/
302+
public List<String> suspensionReasons() {
303+
return this.suspensionReasons;
304+
}
305+
288306
/**
289307
* Validates the instance.
290308
*

sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.azure.resourcemanager.billing.models.PaymentProperties;
1717
import com.azure.resourcemanager.billing.models.RebillDetails;
1818
import com.fasterxml.jackson.annotation.JsonIgnore;
19+
import com.fasterxml.jackson.annotation.JsonInclude;
1920
import com.fasterxml.jackson.annotation.JsonProperty;
2021
import java.time.OffsetDateTime;
2122
import java.util.List;
@@ -163,6 +164,7 @@ public class InvoiceInner extends ProxyResource {
163164
* Rebill details for an invoice.
164165
*/
165166
@JsonProperty(value = "properties.rebillDetails", access = JsonProperty.Access.WRITE_ONLY)
167+
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
166168
private Map<String, RebillDetails> rebillDetails;
167169

168170
/*

sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.azure.resourcemanager.billing.models.InvoiceSectionState;
1212
import com.azure.resourcemanager.billing.models.TargetCloud;
1313
import com.fasterxml.jackson.annotation.JsonIgnore;
14+
import com.fasterxml.jackson.annotation.JsonInclude;
1415
import com.fasterxml.jackson.annotation.JsonProperty;
1516
import java.util.Map;
1617

@@ -30,6 +31,7 @@ public class InvoiceSectionInner extends ProxyResource {
3031
* Dictionary of metadata associated with the invoice section.
3132
*/
3233
@JsonProperty(value = "properties.labels")
34+
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
3335
private Map<String, String> labels;
3436

3537
/*
@@ -44,6 +46,15 @@ public class InvoiceSectionInner extends ProxyResource {
4446
@JsonProperty(value = "properties.systemId", access = JsonProperty.Access.WRITE_ONLY)
4547
private String systemId;
4648

49+
/*
50+
* Dictionary of metadata associated with the invoice section. Maximum
51+
* key/value length supported of 256 characters. Keys/value should not
52+
* empty value nor null. Keys can not contain < > % & \ ? /
53+
*/
54+
@JsonProperty(value = "properties.tags")
55+
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
56+
private Map<String, String> tags;
57+
4758
/*
4859
* Identifies the cloud environments that are associated with an invoice
4960
* section. This is a system managed optional field and gets updated as the
@@ -110,6 +121,30 @@ public String systemId() {
110121
return this.systemId;
111122
}
112123

124+
/**
125+
* Get the tags property: Dictionary of metadata associated with the invoice section. Maximum key/value length
126+
* supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain &lt; &gt; % &amp; \
127+
* ? /.
128+
*
129+
* @return the tags value.
130+
*/
131+
public Map<String, String> tags() {
132+
return this.tags;
133+
}
134+
135+
/**
136+
* Set the tags property: Dictionary of metadata associated with the invoice section. Maximum key/value length
137+
* supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain &lt; &gt; % &amp; \
138+
* ? /.
139+
*
140+
* @param tags the tags value to set.
141+
* @return the InvoiceSectionInner object itself.
142+
*/
143+
public InvoiceSectionInner withTags(Map<String, String> tags) {
144+
this.tags = tags;
145+
return this;
146+
}
147+
113148
/**
114149
* Get the targetCloud property: Identifies the cloud environments that are associated with an invoice section. This
115150
* is a system managed optional field and gets updated as the invoice section gets associated with accounts in

sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import com.azure.resourcemanager.billing.models.BillingSubscription;
1010
import com.azure.resourcemanager.billing.models.BillingSubscriptionStatusType;
1111
import com.azure.resourcemanager.billing.models.Reseller;
12+
import java.util.Collections;
13+
import java.util.List;
1214
import java.util.UUID;
1315

1416
public final class BillingSubscriptionImpl implements BillingSubscription {
@@ -94,6 +96,15 @@ public String skuDescription() {
9496
return this.innerModel().skuDescription();
9597
}
9698

99+
public List<String> suspensionReasons() {
100+
List<String> inner = this.innerModel().suspensionReasons();
101+
if (inner != null) {
102+
return Collections.unmodifiableList(inner);
103+
} else {
104+
return Collections.emptyList();
105+
}
106+
}
107+
97108
public BillingSubscriptionInner innerModel() {
98109
return this.innerObject;
99110
}

0 commit comments

Comments
 (0)