Skip to content

Commit 508f9d6

Browse files
author
SDKAuto
committed
CodeGen from PR 14830 in Azure/azure-rest-api-specs
Merge d98744647dd59d2a657b878285b5b4b6e45be3dd into c2e43f82e91ff7ad691381df56c535164b354cba
1 parent 7989020 commit 508f9d6

File tree

8 files changed

+129
-91
lines changed

8 files changed

+129
-91
lines changed

sdk/batch/azure-resourcemanager-batch/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-06-24)
44

5+
- Azure Resource Manager Batch client library for Java. This package contains Microsoft Azure SDK for Batch Management SDK. Package tag package-2021-01. 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-21)
78

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

Lines changed: 8 additions & 6 deletions
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-batch</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,13 +74,15 @@ 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
8082

8183
## Contributing
8284

83-
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).
85+
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md).
8486

8587
1. Fork it
8688
1. Create your feature branch (`git checkout -b my-new-feature`)
@@ -93,7 +95,7 @@ For details on contributing to this repository, see the [contributing guide](htt
9395
[docs]: https://azure.github.io/azure-sdk-for-java/
9496
[jdk]: https://docs.microsoft.com/java/azure/jdk/
9597
[azure_subscription]: https://azure.microsoft.com/free/
96-
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
97-
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
98-
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
99-
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md
98+
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity
99+
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty
100+
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md
101+
[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md
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-batch</artifactId>
12-
<version>1.0.0-beta.2</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-batch;current} -->
13-
<packaging>jar</packaging>
10+
<groupId>com.azure.resourcemanager</groupId>
11+
<artifactId>azure-resourcemanager-batch</artifactId>
12+
<version>1.0.0-beta.2</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-batch;current} -->
13+
<packaging>jar</packaging>
1414

15-
<name>Microsoft Azure SDK for Batch Management</name>
16-
<description>This package contains Microsoft Azure SDK for Batch Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-01.</description>
17-
<url>https://github.com/Azure/azure-sdk-for-java</url>
15+
<name>Microsoft Azure SDK for Batch Management</name>
16+
<description>This package contains Microsoft Azure SDK for Batch Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-01.</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:[email protected]:Azure/azure-sdk-for-java.git</connection>
30-
<developerConnection>scm:git:[email protected]: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.17.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.3.0</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:[email protected]:Azure/azure-sdk-for-java.git</connection>
30+
<developerConnection>scm:git:[email protected]: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.17.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.3.0</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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/BatchManager.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;
@@ -109,6 +109,7 @@ public static final class Configurable {
109109
private HttpClient httpClient;
110110
private HttpLogOptions httpLogOptions;
111111
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
112+
private final List<String> scopes = new ArrayList<>();
112113
private RetryPolicy retryPolicy;
113114
private Duration defaultPollInterval;
114115

@@ -148,6 +149,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) {
148149
return this;
149150
}
150151

152+
/**
153+
* Adds the scope to permission sets.
154+
*
155+
* @param scope the scope.
156+
* @return the configurable object itself.
157+
*/
158+
public Configurable withScope(String scope) {
159+
this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
160+
return this;
161+
}
162+
151163
/**
152164
* Sets the retry policy to the HTTP pipeline.
153165
*
@@ -204,6 +216,9 @@ public BatchManager authenticate(TokenCredential credential, AzureProfile profil
204216
userAgentBuilder.append(" (auto-generated)");
205217
}
206218

219+
if (scopes.isEmpty()) {
220+
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
221+
}
207222
if (retryPolicy == null) {
208223
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
209224
}
@@ -213,10 +228,7 @@ public BatchManager authenticate(TokenCredential credential, AzureProfile profil
213228
HttpPolicyProviders.addBeforeRetryPolicies(policies);
214229
policies.add(retryPolicy);
215230
policies.add(new AddDatePolicy());
216-
policies
217-
.add(
218-
new BearerTokenAuthenticationPolicy(
219-
credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
231+
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
220232
policies.addAll(this.policies);
221233
HttpPolicyProviders.addAfterRetryPolicies(policies);
222234
policies.add(new HttpLoggingPolicy(httpLogOptions));

sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificateImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,20 +261,20 @@ public CertificateImpl withPassword(String password) {
261261
}
262262

263263
public CertificateImpl withIfMatch(String ifMatch) {
264-
this.createIfMatch = ifMatch;
265-
return this;
264+
if (isInCreateMode()) {
265+
this.createIfMatch = ifMatch;
266+
return this;
267+
} else {
268+
this.updateIfMatch = ifMatch;
269+
return this;
270+
}
266271
}
267272

268273
public CertificateImpl withIfNoneMatch(String ifNoneMatch) {
269274
this.createIfNoneMatch = ifNoneMatch;
270275
return this;
271276
}
272277

273-
public CertificateImpl ifMatch(String ifMatch) {
274-
this.updateIfMatch = ifMatch;
275-
return this;
276-
}
277-
278278
private boolean isInCreateMode() {
279279
return this.innerModel().id() == null;
280280
}

sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolImpl.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,17 +402,21 @@ public PoolImpl withMountConfiguration(List<MountConfiguration> mountConfigurati
402402
}
403403

404404
public PoolImpl withIfMatch(String ifMatch) {
405-
this.createIfMatch = ifMatch;
406-
return this;
405+
if (isInCreateMode()) {
406+
this.createIfMatch = ifMatch;
407+
return this;
408+
} else {
409+
this.updateIfMatch = ifMatch;
410+
return this;
411+
}
407412
}
408413

409414
public PoolImpl withIfNoneMatch(String ifNoneMatch) {
410415
this.createIfNoneMatch = ifNoneMatch;
411416
return this;
412417
}
413418

414-
public PoolImpl ifMatch(String ifMatch) {
415-
this.updateIfMatch = ifMatch;
416-
return this;
419+
private boolean isInCreateMode() {
420+
return this.innerModel().id() == null;
417421
}
418422
}

sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificate.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ interface Update
253253
UpdateStages.WithFormat,
254254
UpdateStages.WithData,
255255
UpdateStages.WithPassword,
256-
UpdateStages.WithifMatch {
256+
UpdateStages.WithIfMatch {
257257
/**
258258
* Executes the update request.
259259
*
@@ -325,7 +325,7 @@ interface WithPassword {
325325
Update withPassword(String password);
326326
}
327327
/** The stage of the Certificate update allowing to specify ifMatch. */
328-
interface WithifMatch {
328+
interface WithIfMatch {
329329
/**
330330
* Specifies the ifMatch property: The entity state (ETag) version of the certificate to update. This value
331331
* can be omitted or set to "*" to apply the operation unconditionally..
@@ -334,7 +334,7 @@ interface WithifMatch {
334334
* set to "*" to apply the operation unconditionally.
335335
* @return the next definition stage.
336336
*/
337-
Update ifMatch(String ifMatch);
337+
Update withIfMatch(String ifMatch);
338338
}
339339
}
340340
/**

sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pool.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ interface Update
584584
UpdateStages.WithApplicationPackages,
585585
UpdateStages.WithApplicationLicenses,
586586
UpdateStages.WithMountConfiguration,
587-
UpdateStages.WithifMatch {
587+
UpdateStages.WithIfMatch {
588588
/**
589589
* Executes the update request.
590590
*
@@ -821,7 +821,7 @@ interface WithMountConfiguration {
821821
Update withMountConfiguration(List<MountConfiguration> mountConfiguration);
822822
}
823823
/** The stage of the Pool update allowing to specify ifMatch. */
824-
interface WithifMatch {
824+
interface WithIfMatch {
825825
/**
826826
* Specifies the ifMatch property: The entity state (ETag) version of the pool to update. This value can be
827827
* omitted or set to "*" to apply the operation unconditionally..
@@ -830,7 +830,7 @@ interface WithifMatch {
830830
* "*" to apply the operation unconditionally.
831831
* @return the next definition stage.
832832
*/
833-
Update ifMatch(String ifMatch);
833+
Update withIfMatch(String ifMatch);
834834
}
835835
}
836836
/**

0 commit comments

Comments
 (0)