Skip to content

Commit 7328e89

Browse files
author
SDKAuto
committed
CodeGen from PR 12427 in Azure/azure-rest-api-specs
Merge 39dfb522c1f81f3c07492253323d969780a4fd17 into b392b4e5d04c73acde2c02ed034247ac55b8892f
1 parent c03987c commit 7328e89

File tree

13 files changed

+87
-685
lines changed

13 files changed

+87
-685
lines changed

sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/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.1.0-beta.1 (Unreleased)
3+
## 1.0.0-beta.1 (2021-06-16)
44

5+
- Azure Resource Manager IotDps client library for Java. This package contains Microsoft Azure SDK for IotDps Management SDK. API for using the Azure IoT Hub Device Provisioning Service features. Package tag package-2020-03. 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 (2021-05-28)
78

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Thank you in advance for your collaboration. We really appreciate your time!
1717
Various documentation is available to help you get started
1818

1919
- [API reference documentation][docs]
20-
- [Service documentation][service_docs]
2120

2221
## Getting started
2322

@@ -33,7 +32,7 @@ Various documentation is available to help you get started
3332
<dependency>
3433
<groupId>com.azure.resourcemanager</groupId>
3534
<artifactId>azure-resourcemanager-deviceprovisioningservices</artifactId>
36-
<version>1.0.0</version>
35+
<version>1.1.0-beta.1</version>
3736
</dependency>
3837
```
3938
[//]: # ({x-version-update-end})
@@ -100,4 +99,3 @@ For details on contributing to this repository, see the [contributing guide](htt
10099
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty
101100
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md
102101
[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md
103-
[service_docs]: https://docs.microsoft.com/azure/iot-dps

sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/IotDpsManager.java

Lines changed: 18 additions & 6 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;
@@ -85,6 +85,7 @@ public static final class Configurable {
8585
private HttpClient httpClient;
8686
private HttpLogOptions httpLogOptions;
8787
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
88+
private final List<String> scopes = new ArrayList<>();
8889
private RetryPolicy retryPolicy;
8990
private Duration defaultPollInterval;
9091

@@ -124,6 +125,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) {
124125
return this;
125126
}
126127

128+
/**
129+
* Adds the scope to permission sets.
130+
*
131+
* @param scope the scope.
132+
* @return the configurable object itself.
133+
*/
134+
public Configurable withScope(String scope) {
135+
this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
136+
return this;
137+
}
138+
127139
/**
128140
* Sets the retry policy to the HTTP pipeline.
129141
*
@@ -166,7 +178,7 @@ public IotDpsManager authenticate(TokenCredential credential, AzureProfile profi
166178
.append("-")
167179
.append("com.azure.resourcemanager.deviceprovisioningservices")
168180
.append("/")
169-
.append("1.0.0");
181+
.append("1.0.0-beta.1");
170182
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
171183
userAgentBuilder
172184
.append(" (")
@@ -180,6 +192,9 @@ public IotDpsManager authenticate(TokenCredential credential, AzureProfile profi
180192
userAgentBuilder.append(" (auto-generated)");
181193
}
182194

195+
if (scopes.isEmpty()) {
196+
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
197+
}
183198
if (retryPolicy == null) {
184199
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
185200
}
@@ -189,10 +204,7 @@ public IotDpsManager authenticate(TokenCredential credential, AzureProfile profi
189204
HttpPolicyProviders.addBeforeRetryPolicies(policies);
190205
policies.add(retryPolicy);
191206
policies.add(new AddDatePolicy());
192-
policies
193-
.add(
194-
new BearerTokenAuthenticationPolicy(
195-
credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
207+
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
196208
policies.addAll(this.policies);
197209
HttpPolicyProviders.addAfterRetryPolicies(policies);
198210
policies.add(new HttpLoggingPolicy(httpLogOptions));

sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateResponseImpl.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ public CertificateResponseImpl withCertificate(String certificate) {
187187
}
188188
}
189189

190+
public CertificateResponseImpl withIsVerified(Boolean isVerified) {
191+
if (isInCreateMode()) {
192+
this.createCertificateDescription.withIsVerified(isVerified);
193+
return this;
194+
} else {
195+
this.updateCertificateDescription.withIsVerified(isVerified);
196+
return this;
197+
}
198+
}
199+
190200
public CertificateResponseImpl withIfMatch(String ifMatch) {
191201
if (isInCreateMode()) {
192202
this.createIfMatch = ifMatch;

sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateBodyDescription.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ public final class CertificateBodyDescription {
2121
@JsonProperty(value = "certificate")
2222
private String certificate;
2323

24+
/*
25+
* True indicates that the certificate will be created in verified state
26+
* and proof of possession will not be required.
27+
*/
28+
@JsonProperty(value = "isVerified")
29+
private Boolean isVerified;
30+
2431
/**
2532
* Get the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just .pem file
2633
* content.
@@ -43,6 +50,28 @@ public CertificateBodyDescription withCertificate(String certificate) {
4350
return this;
4451
}
4552

53+
/**
54+
* Get the isVerified property: True indicates that the certificate will be created in verified state and proof of
55+
* possession will not be required.
56+
*
57+
* @return the isVerified value.
58+
*/
59+
public Boolean isVerified() {
60+
return this.isVerified;
61+
}
62+
63+
/**
64+
* Set the isVerified property: True indicates that the certificate will be created in verified state and proof of
65+
* possession will not be required.
66+
*
67+
* @param isVerified the isVerified value to set.
68+
* @return the CertificateBodyDescription object itself.
69+
*/
70+
public CertificateBodyDescription withIsVerified(Boolean isVerified) {
71+
this.isVerified = isVerified;
72+
return this;
73+
}
74+
4675
/**
4776
* Validates the instance.
4877
*

sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateResponse.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ interface WithParentResource {
7676
* The stage of the CertificateResponse definition which contains all the minimum required properties for the
7777
* resource to be created, but also allows for any other optional properties to be specified.
7878
*/
79-
interface WithCreate extends DefinitionStages.WithCertificate, DefinitionStages.WithIfMatch {
79+
interface WithCreate
80+
extends DefinitionStages.WithCertificate, DefinitionStages.WithIsVerified, DefinitionStages.WithIfMatch {
8081
/**
8182
* Executes the create request.
8283
*
@@ -104,6 +105,18 @@ interface WithCertificate {
104105
*/
105106
WithCreate withCertificate(String certificate);
106107
}
108+
/** The stage of the CertificateResponse definition allowing to specify isVerified. */
109+
interface WithIsVerified {
110+
/**
111+
* Specifies the isVerified property: True indicates that the certificate will be created in verified state
112+
* and proof of possession will not be required..
113+
*
114+
* @param isVerified True indicates that the certificate will be created in verified state and proof of
115+
* possession will not be required.
116+
* @return the next definition stage.
117+
*/
118+
WithCreate withIsVerified(Boolean isVerified);
119+
}
107120
/** The stage of the CertificateResponse definition allowing to specify ifMatch. */
108121
interface WithIfMatch {
109122
/**
@@ -125,7 +138,7 @@ interface WithIfMatch {
125138
CertificateResponse.Update update();
126139

127140
/** The template for CertificateResponse update. */
128-
interface Update extends UpdateStages.WithCertificate, UpdateStages.WithIfMatch {
141+
interface Update extends UpdateStages.WithCertificate, UpdateStages.WithIsVerified, UpdateStages.WithIfMatch {
129142
/**
130143
* Executes the update request.
131144
*
@@ -155,6 +168,18 @@ interface WithCertificate {
155168
*/
156169
Update withCertificate(String certificate);
157170
}
171+
/** The stage of the CertificateResponse update allowing to specify isVerified. */
172+
interface WithIsVerified {
173+
/**
174+
* Specifies the isVerified property: True indicates that the certificate will be created in verified state
175+
* and proof of possession will not be required..
176+
*
177+
* @param isVerified True indicates that the certificate will be created in verified state and proof of
178+
* possession will not be required.
179+
* @return the next definition stage.
180+
*/
181+
Update withIsVerified(Boolean isVerified);
182+
}
158183
/** The stage of the CertificateResponse update allowing to specify ifMatch. */
159184
interface WithIfMatch {
160185
/**

sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/AllocationPolicyTests.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)