Skip to content

Commit a4fea12

Browse files
author
SDKAuto
committed
CodeGen from PR 19273 in Azure/azure-rest-api-specs
Merge b91ffac4f3b4981092c1d868dfffd85590e476b8 into 2e59fa3ef47822961f3bde711183859729fc9970
1 parent da4e060 commit a4fea12

File tree

122 files changed

+469
-765
lines changed

Some content is hidden

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

122 files changed

+469
-765
lines changed

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

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

3-
## 1.2.0-beta.2 (Unreleased)
3+
## 1.0.0-beta.1 (2022-06-02)
4+
5+
- Azure Resource Manager IotHub client library for Java. This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2021-07-02. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
46

57
### Features Added
68

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

Lines changed: 1 addition & 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-iothub</artifactId>
35-
<version>1.2.0-beta.1</version>
35+
<version>1.2.0-beta.2</version>
3636
</dependency>
3737
```
3838
[//]: # ({x-version-update-end})

sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java

Lines changed: 76 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
import com.azure.core.http.HttpPipelineBuilder;
1111
import com.azure.core.http.HttpPipelinePosition;
1212
import com.azure.core.http.policy.AddDatePolicy;
13+
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
1314
import com.azure.core.http.policy.HttpLogOptions;
1415
import com.azure.core.http.policy.HttpLoggingPolicy;
1516
import com.azure.core.http.policy.HttpPipelinePolicy;
1617
import com.azure.core.http.policy.HttpPolicyProviders;
1718
import com.azure.core.http.policy.RequestIdPolicy;
19+
import com.azure.core.http.policy.RetryOptions;
1820
import com.azure.core.http.policy.RetryPolicy;
1921
import com.azure.core.http.policy.UserAgentPolicy;
2022
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
@@ -87,6 +89,19 @@ public static IotHubManager authenticate(TokenCredential credential, AzureProfil
8789
return configure().authenticate(credential, profile);
8890
}
8991

92+
/**
93+
* Creates an instance of IotHub service API entry point.
94+
*
95+
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
96+
* @param profile the Azure profile for client.
97+
* @return the IotHub service API instance.
98+
*/
99+
public static IotHubManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
100+
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
101+
Objects.requireNonNull(profile, "'profile' cannot be null.");
102+
return new IotHubManager(httpPipeline, profile, null);
103+
}
104+
90105
/**
91106
* Gets a Configurable instance that can be used to create IotHubManager with optional configuration.
92107
*
@@ -98,13 +113,14 @@ public static Configurable configure() {
98113

99114
/** The Configurable allowing configurations to be set. */
100115
public static final class Configurable {
101-
private final ClientLogger logger = new ClientLogger(Configurable.class);
116+
private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);
102117

103118
private HttpClient httpClient;
104119
private HttpLogOptions httpLogOptions;
105120
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
106121
private final List<String> scopes = new ArrayList<>();
107122
private RetryPolicy retryPolicy;
123+
private RetryOptions retryOptions;
108124
private Duration defaultPollInterval;
109125

110126
private Configurable() {
@@ -165,16 +181,31 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
165181
return this;
166182
}
167183

184+
/**
185+
* Sets the retry options for the HTTP pipeline retry policy.
186+
*
187+
* <p>This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
188+
*
189+
* @param retryOptions the retry options for the HTTP pipeline retry policy.
190+
* @return the configurable object itself.
191+
*/
192+
public Configurable withRetryOptions(RetryOptions retryOptions) {
193+
this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
194+
return this;
195+
}
196+
168197
/**
169198
* Sets the default poll interval, used when service does not provide "Retry-After" header.
170199
*
171200
* @param defaultPollInterval the default poll interval.
172201
* @return the configurable object itself.
173202
*/
174203
public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
175-
this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null.");
204+
this.defaultPollInterval =
205+
Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null.");
176206
if (this.defaultPollInterval.isNegative()) {
177-
throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative"));
207+
throw LOGGER
208+
.logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative"));
178209
}
179210
return this;
180211
}
@@ -196,7 +227,7 @@ public IotHubManager authenticate(TokenCredential credential, AzureProfile profi
196227
.append("-")
197228
.append("com.azure.resourcemanager.iothub")
198229
.append("/")
199-
.append("1.2.0-beta.1");
230+
.append("1.0.0-beta.1");
200231
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
201232
userAgentBuilder
202233
.append(" (")
@@ -214,10 +245,15 @@ public IotHubManager authenticate(TokenCredential credential, AzureProfile profi
214245
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
215246
}
216247
if (retryPolicy == null) {
217-
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
248+
if (retryOptions != null) {
249+
retryPolicy = new RetryPolicy(retryOptions);
250+
} else {
251+
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
252+
}
218253
}
219254
List<HttpPipelinePolicy> policies = new ArrayList<>();
220255
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
256+
policies.add(new AddHeadersFromContextPolicy());
221257
policies.add(new RequestIdPolicy());
222258
policies
223259
.addAll(
@@ -248,23 +284,35 @@ public IotHubManager authenticate(TokenCredential credential, AzureProfile profi
248284
}
249285
}
250286

251-
/** @return Resource collection API of Operations. */
287+
/**
288+
* Gets the resource collection API of Operations.
289+
*
290+
* @return Resource collection API of Operations.
291+
*/
252292
public Operations operations() {
253293
if (this.operations == null) {
254294
this.operations = new OperationsImpl(clientObject.getOperations(), this);
255295
}
256296
return operations;
257297
}
258298

259-
/** @return Resource collection API of IotHubResources. */
299+
/**
300+
* Gets the resource collection API of IotHubResources. It manages IotHubDescription, EventHubConsumerGroupInfo.
301+
*
302+
* @return Resource collection API of IotHubResources.
303+
*/
260304
public IotHubResources iotHubResources() {
261305
if (this.iotHubResources == null) {
262306
this.iotHubResources = new IotHubResourcesImpl(clientObject.getIotHubResources(), this);
263307
}
264308
return iotHubResources;
265309
}
266310

267-
/** @return Resource collection API of ResourceProviderCommons. */
311+
/**
312+
* Gets the resource collection API of ResourceProviderCommons.
313+
*
314+
* @return Resource collection API of ResourceProviderCommons.
315+
*/
268316
public ResourceProviderCommons resourceProviderCommons() {
269317
if (this.resourceProviderCommons == null) {
270318
this.resourceProviderCommons =
@@ -273,23 +321,35 @@ public ResourceProviderCommons resourceProviderCommons() {
273321
return resourceProviderCommons;
274322
}
275323

276-
/** @return Resource collection API of Certificates. */
324+
/**
325+
* Gets the resource collection API of Certificates. It manages CertificateDescription.
326+
*
327+
* @return Resource collection API of Certificates.
328+
*/
277329
public Certificates certificates() {
278330
if (this.certificates == null) {
279331
this.certificates = new CertificatesImpl(clientObject.getCertificates(), this);
280332
}
281333
return certificates;
282334
}
283335

284-
/** @return Resource collection API of IotHubs. */
336+
/**
337+
* Gets the resource collection API of IotHubs.
338+
*
339+
* @return Resource collection API of IotHubs.
340+
*/
285341
public IotHubs iotHubs() {
286342
if (this.iotHubs == null) {
287343
this.iotHubs = new IotHubsImpl(clientObject.getIotHubs(), this);
288344
}
289345
return iotHubs;
290346
}
291347

292-
/** @return Resource collection API of PrivateLinkResourcesOperations. */
348+
/**
349+
* Gets the resource collection API of PrivateLinkResourcesOperations.
350+
*
351+
* @return Resource collection API of PrivateLinkResourcesOperations.
352+
*/
293353
public PrivateLinkResourcesOperations privateLinkResourcesOperations() {
294354
if (this.privateLinkResourcesOperations == null) {
295355
this.privateLinkResourcesOperations =
@@ -298,7 +358,11 @@ public PrivateLinkResourcesOperations privateLinkResourcesOperations() {
298358
return privateLinkResourcesOperations;
299359
}
300360

301-
/** @return Resource collection API of PrivateEndpointConnections. */
361+
/**
362+
* Gets the resource collection API of PrivateEndpointConnections.
363+
*
364+
* @return Resource collection API of PrivateEndpointConnections.
365+
*/
302366
public PrivateEndpointConnections privateEndpointConnections() {
303367
if (this.privateEndpointConnections == null) {
304368
this.privateEndpointConnections =

0 commit comments

Comments
 (0)