Skip to content

Commit ae98b2d

Browse files
author
SDKAuto
committed
CodeGen from PR 16250 in Azure/azure-rest-api-specs
Merge 3ff6f1cdf049090dc56ffd3001c22de0bdd218b7 into a87e536b2060dfe47c4d2bbf24a7f32d67944f9c
1 parent 596d3e5 commit ae98b2d

File tree

95 files changed

+8242
-1746
lines changed

Some content is hidden

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

95 files changed

+8242
-1746
lines changed

sdk/policyinsights/azure-resourcemanager-policyinsights/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-10-26)
44

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

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

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

33
Azure Resource Manager PolicyInsights client library for Java.
44

5-
This package contains Microsoft Azure SDK for PolicyInsights 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).
5+
This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-10. 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

@@ -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-policyinsights</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,9 @@ See [API design][design] for general introduction on design and key concepts on
7474

7575
## Examples
7676

77+
[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/policyinsights/azure-resourcemanager-policyinsights/SAMPLE.md)
78+
79+
7780
## Troubleshooting
7881

7982
## Next steps

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

Lines changed: 3422 additions & 0 deletions
Large diffs are not rendered by default.
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-policyinsights</artifactId>
12-
<version>1.0.0-beta.2</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-policyinsights;current} -->
13-
<packaging>jar</packaging>
10+
<groupId>com.azure.resourcemanager</groupId>
11+
<artifactId>azure-resourcemanager-policyinsights</artifactId>
12+
<version>1.0.0-beta.2</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-policyinsights;current} -->
13+
<packaging>jar</packaging>
1414

15-
<name>Microsoft Azure SDK for PolicyInsights Management</name>
16-
<description>This package contains Microsoft Azure SDK for PolicyInsights 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 PolicyInsights Management</name>
16+
<description>This package contains Microsoft Azure SDK for PolicyInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-10.</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.21.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.2</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.7</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.21.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.2</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.7</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/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.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;
@@ -105,6 +105,7 @@ public static final class Configurable {
105105
private HttpClient httpClient;
106106
private HttpLogOptions httpLogOptions;
107107
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
108+
private final List<String> scopes = new ArrayList<>();
108109
private RetryPolicy retryPolicy;
109110
private Duration defaultPollInterval;
110111

@@ -144,6 +145,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) {
144145
return this;
145146
}
146147

148+
/**
149+
* Adds the scope to permission sets.
150+
*
151+
* @param scope the scope.
152+
* @return the configurable object itself.
153+
*/
154+
public Configurable withScope(String scope) {
155+
this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
156+
return this;
157+
}
158+
147159
/**
148160
* Sets the retry policy to the HTTP pipeline.
149161
*
@@ -200,6 +212,9 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi
200212
userAgentBuilder.append(" (auto-generated)");
201213
}
202214

215+
if (scopes.isEmpty()) {
216+
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
217+
}
203218
if (retryPolicy == null) {
204219
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
205220
}
@@ -209,10 +224,7 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi
209224
HttpPolicyProviders.addBeforeRetryPolicies(policies);
210225
policies.add(retryPolicy);
211226
policies.add(new AddDatePolicy());
212-
policies
213-
.add(
214-
new BearerTokenAuthenticationPolicy(
215-
credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
227+
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
216228
policies.addAll(this.policies);
217229
HttpPolicyProviders.addAfterRetryPolicies(policies);
218230
policies.add(new HttpLoggingPolicy(httpLogOptions));

sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/AttestationsClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public interface AttestationsClient {
4949
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
5050
* @return an attestation resource.
5151
*/
52-
@ServiceMethod(returns = ReturnType.SINGLE)
52+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
5353
SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAtSubscription(
5454
String attestationName, AttestationInner parameters);
5555

@@ -64,7 +64,7 @@ SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAt
6464
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
6565
* @return an attestation resource.
6666
*/
67-
@ServiceMethod(returns = ReturnType.SINGLE)
67+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
6868
SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAtSubscription(
6969
String attestationName, AttestationInner parameters, Context context);
7070

@@ -183,7 +183,7 @@ PagedIterable<AttestationInner> listByResourceGroup(
183183
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
184184
* @return an attestation resource.
185185
*/
186-
@ServiceMethod(returns = ReturnType.SINGLE)
186+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
187187
SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAtResourceGroup(
188188
String resourceGroupName, String attestationName, AttestationInner parameters);
189189

@@ -199,7 +199,7 @@ SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAt
199199
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
200200
* @return an attestation resource.
201201
*/
202-
@ServiceMethod(returns = ReturnType.SINGLE)
202+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
203203
SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAtResourceGroup(
204204
String resourceGroupName, String attestationName, AttestationInner parameters, Context context);
205205

@@ -326,7 +326,7 @@ Response<AttestationInner> getByResourceGroupWithResponse(
326326
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
327327
* @return an attestation resource.
328328
*/
329-
@ServiceMethod(returns = ReturnType.SINGLE)
329+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
330330
SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAtResource(
331331
String resourceId, String attestationName, AttestationInner parameters);
332332

@@ -342,7 +342,7 @@ SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAt
342342
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
343343
* @return an attestation resource.
344344
*/
345-
@ServiceMethod(returns = ReturnType.SINGLE)
345+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
346346
SyncPoller<PollResult<AttestationInner>, AttestationInner> beginCreateOrUpdateAtResource(
347347
String resourceId, String attestationName, AttestationInner parameters, Context context);
348348

sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyStatesClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ Response<SummarizeResultsInner> summarizeForResourceWithResponse(
389389
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
390390
* @return the completion.
391391
*/
392-
@ServiceMethod(returns = ReturnType.SINGLE)
392+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
393393
SyncPoller<PollResult<Void>, Void> beginTriggerSubscriptionEvaluation(String subscriptionId);
394394

395395
/**
@@ -402,7 +402,7 @@ Response<SummarizeResultsInner> summarizeForResourceWithResponse(
402402
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
403403
* @return the completion.
404404
*/
405-
@ServiceMethod(returns = ReturnType.SINGLE)
405+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
406406
SyncPoller<PollResult<Void>, Void> beginTriggerSubscriptionEvaluation(String subscriptionId, Context context);
407407

408408
/**
@@ -438,7 +438,7 @@ Response<SummarizeResultsInner> summarizeForResourceWithResponse(
438438
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
439439
* @return the completion.
440440
*/
441-
@ServiceMethod(returns = ReturnType.SINGLE)
441+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
442442
SyncPoller<PollResult<Void>, Void> beginTriggerResourceGroupEvaluation(
443443
String subscriptionId, String resourceGroupName);
444444

@@ -453,7 +453,7 @@ SyncPoller<PollResult<Void>, Void> beginTriggerResourceGroupEvaluation(
453453
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
454454
* @return the completion.
455455
*/
456-
@ServiceMethod(returns = ReturnType.SINGLE)
456+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
457457
SyncPoller<PollResult<Void>, Void> beginTriggerResourceGroupEvaluation(
458458
String subscriptionId, String resourceGroupName, Context context);
459459

0 commit comments

Comments
 (0)