Skip to content

Commit c5fe3d4

Browse files
author
SDKAuto
committed
CodeGen from PR 19034 in Azure/azure-rest-api-specs
Merge 3873c01adf26765e0775255d2d45584e530f5a31 into 9be5d475168131b188f254f5d14b23086512a9d3
1 parent 2297e15 commit c5fe3d4

26 files changed

+249
-214
lines changed

sdk/extendedlocation/azure-resourcemanager-extendedlocation/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.0.0-beta.2 (Unreleased)
3+
## 1.0.0-beta.1 (2022-05-24)
4+
5+
- Azure Resource Manager CustomLocations client library for Java. This package contains Microsoft Azure SDK for CustomLocations Management SDK. The customLocations Rest API spec. Package tag package-2021-08-15. 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/extendedlocation/azure-resourcemanager-extendedlocation/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-extendedlocation</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})

sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/CustomLocationsManager.java

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
import com.azure.core.http.HttpClient;
99
import com.azure.core.http.HttpPipeline;
1010
import com.azure.core.http.HttpPipelineBuilder;
11+
import com.azure.core.http.HttpPipelinePosition;
1112
import com.azure.core.http.policy.AddDatePolicy;
13+
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
1214
import com.azure.core.http.policy.HttpLogOptions;
1315
import com.azure.core.http.policy.HttpLoggingPolicy;
1416
import com.azure.core.http.policy.HttpPipelinePolicy;
1517
import com.azure.core.http.policy.HttpPolicyProviders;
1618
import com.azure.core.http.policy.RequestIdPolicy;
19+
import com.azure.core.http.policy.RetryOptions;
1720
import com.azure.core.http.policy.RetryPolicy;
1821
import com.azure.core.http.policy.UserAgentPolicy;
1922
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
@@ -29,6 +32,7 @@
2932
import java.util.ArrayList;
3033
import java.util.List;
3134
import java.util.Objects;
35+
import java.util.stream.Collectors;
3236

3337
/** Entry point to CustomLocationsManager. The customLocations Rest API spec. */
3438
public final class CustomLocationsManager {
@@ -61,6 +65,19 @@ public static CustomLocationsManager authenticate(TokenCredential credential, Az
6165
return configure().authenticate(credential, profile);
6266
}
6367

68+
/**
69+
* Creates an instance of CustomLocations service API entry point.
70+
*
71+
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
72+
* @param profile the Azure profile for client.
73+
* @return the CustomLocations service API instance.
74+
*/
75+
public static CustomLocationsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
76+
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
77+
Objects.requireNonNull(profile, "'profile' cannot be null.");
78+
return new CustomLocationsManager(httpPipeline, profile, null);
79+
}
80+
6481
/**
6582
* Gets a Configurable instance that can be used to create CustomLocationsManager with optional configuration.
6683
*
@@ -72,13 +89,14 @@ public static Configurable configure() {
7289

7390
/** The Configurable allowing configurations to be set. */
7491
public static final class Configurable {
75-
private final ClientLogger logger = new ClientLogger(Configurable.class);
92+
private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);
7693

7794
private HttpClient httpClient;
7895
private HttpLogOptions httpLogOptions;
7996
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
8097
private final List<String> scopes = new ArrayList<>();
8198
private RetryPolicy retryPolicy;
99+
private RetryOptions retryOptions;
82100
private Duration defaultPollInterval;
83101

84102
private Configurable() {
@@ -139,16 +157,31 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
139157
return this;
140158
}
141159

160+
/**
161+
* Sets the retry options for the HTTP pipeline retry policy.
162+
*
163+
* <p>This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
164+
*
165+
* @param retryOptions the retry options for the HTTP pipeline retry policy.
166+
* @return the configurable object itself.
167+
*/
168+
public Configurable withRetryOptions(RetryOptions retryOptions) {
169+
this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
170+
return this;
171+
}
172+
142173
/**
143174
* Sets the default poll interval, used when service does not provide "Retry-After" header.
144175
*
145176
* @param defaultPollInterval the default poll interval.
146177
* @return the configurable object itself.
147178
*/
148179
public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
149-
this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null.");
180+
this.defaultPollInterval =
181+
Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null.");
150182
if (this.defaultPollInterval.isNegative()) {
151-
throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative"));
183+
throw LOGGER
184+
.logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative"));
152185
}
153186
return this;
154187
}
@@ -188,16 +221,34 @@ public CustomLocationsManager authenticate(TokenCredential credential, AzureProf
188221
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
189222
}
190223
if (retryPolicy == null) {
191-
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
224+
if (retryOptions != null) {
225+
retryPolicy = new RetryPolicy(retryOptions);
226+
} else {
227+
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
228+
}
192229
}
193230
List<HttpPipelinePolicy> policies = new ArrayList<>();
194231
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
232+
policies.add(new AddHeadersFromContextPolicy());
195233
policies.add(new RequestIdPolicy());
234+
policies
235+
.addAll(
236+
this
237+
.policies
238+
.stream()
239+
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
240+
.collect(Collectors.toList()));
196241
HttpPolicyProviders.addBeforeRetryPolicies(policies);
197242
policies.add(retryPolicy);
198243
policies.add(new AddDatePolicy());
199244
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
200-
policies.addAll(this.policies);
245+
policies
246+
.addAll(
247+
this
248+
.policies
249+
.stream()
250+
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
251+
.collect(Collectors.toList()));
201252
HttpPolicyProviders.addAfterRetryPolicies(policies);
202253
policies.add(new HttpLoggingPolicy(httpLogOptions));
203254
HttpPipeline httpPipeline =
@@ -209,7 +260,11 @@ public CustomLocationsManager authenticate(TokenCredential credential, AzureProf
209260
}
210261
}
211262

212-
/** @return Resource collection API of CustomLocations. */
263+
/**
264+
* Gets the resource collection API of CustomLocations. It manages CustomLocation.
265+
*
266+
* @return Resource collection API of CustomLocations.
267+
*/
213268
public CustomLocations customLocations() {
214269
if (this.customLocations == null) {
215270
this.customLocations = new CustomLocationsImpl(clientObject.getCustomLocations(), this);

sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/CustomLocationsClient.java

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public interface CustomLocationsClient {
2323
*
2424
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
2525
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
26-
* @return lists of Custom Locations operations.
26+
* @return lists of Custom Locations operations as paginated response with {@link PagedIterable}.
2727
*/
2828
@ServiceMethod(returns = ReturnType.COLLECTION)
2929
PagedIterable<CustomLocationOperationInner> listOperations();
@@ -35,7 +35,7 @@ public interface CustomLocationsClient {
3535
* @throws IllegalArgumentException thrown if parameters fail the validation.
3636
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
3737
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
38-
* @return lists of Custom Locations operations.
38+
* @return lists of Custom Locations operations as paginated response with {@link PagedIterable}.
3939
*/
4040
@ServiceMethod(returns = ReturnType.COLLECTION)
4141
PagedIterable<CustomLocationOperationInner> listOperations(Context context);
@@ -46,7 +46,8 @@ public interface CustomLocationsClient {
4646
*
4747
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
4848
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
49-
* @return a list of Custom Locations in the specified subscription.
49+
* @return a list of Custom Locations in the specified subscription as paginated response with {@link
50+
* PagedIterable}.
5051
*/
5152
@ServiceMethod(returns = ReturnType.COLLECTION)
5253
PagedIterable<CustomLocationInner> list();
@@ -59,7 +60,8 @@ public interface CustomLocationsClient {
5960
* @throws IllegalArgumentException thrown if parameters fail the validation.
6061
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
6162
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
62-
* @return a list of Custom Locations in the specified subscription.
63+
* @return a list of Custom Locations in the specified subscription as paginated response with {@link
64+
* PagedIterable}.
6365
*/
6466
@ServiceMethod(returns = ReturnType.COLLECTION)
6567
PagedIterable<CustomLocationInner> list(Context context);
@@ -72,7 +74,8 @@ public interface CustomLocationsClient {
7274
* @throws IllegalArgumentException thrown if parameters fail the validation.
7375
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
7476
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
75-
* @return a list of Custom Locations in the specified subscription and resource group.
77+
* @return a list of Custom Locations in the specified subscription and resource group as paginated response with
78+
* {@link PagedIterable}.
7679
*/
7780
@ServiceMethod(returns = ReturnType.COLLECTION)
7881
PagedIterable<CustomLocationInner> listByResourceGroup(String resourceGroupName);
@@ -86,7 +89,8 @@ public interface CustomLocationsClient {
8689
* @throws IllegalArgumentException thrown if parameters fail the validation.
8790
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
8891
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
89-
* @return a list of Custom Locations in the specified subscription and resource group.
92+
* @return a list of Custom Locations in the specified subscription and resource group as paginated response with
93+
* {@link PagedIterable}.
9094
*/
9195
@ServiceMethod(returns = ReturnType.COLLECTION)
9296
PagedIterable<CustomLocationInner> listByResourceGroup(String resourceGroupName, Context context);
@@ -113,7 +117,7 @@ public interface CustomLocationsClient {
113117
* @throws IllegalArgumentException thrown if parameters fail the validation.
114118
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
115119
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
116-
* @return the details of the customLocation with a specified resource group and name.
120+
* @return the details of the customLocation with a specified resource group and name along with {@link Response}.
117121
*/
118122
@ServiceMethod(returns = ReturnType.SINGLE)
119123
Response<CustomLocationInner> getByResourceGroupWithResponse(
@@ -128,9 +132,9 @@ Response<CustomLocationInner> getByResourceGroupWithResponse(
128132
* @throws IllegalArgumentException thrown if parameters fail the validation.
129133
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
130134
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
131-
* @return custom Locations definition.
135+
* @return the {@link SyncPoller} for polling of custom Locations definition.
132136
*/
133-
@ServiceMethod(returns = ReturnType.SINGLE)
137+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
134138
SyncPoller<PollResult<CustomLocationInner>, CustomLocationInner> beginCreateOrUpdate(
135139
String resourceGroupName, String resourceName, CustomLocationInner parameters);
136140

@@ -144,9 +148,9 @@ SyncPoller<PollResult<CustomLocationInner>, CustomLocationInner> beginCreateOrUp
144148
* @throws IllegalArgumentException thrown if parameters fail the validation.
145149
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
146150
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
147-
* @return custom Locations definition.
151+
* @return the {@link SyncPoller} for polling of custom Locations definition.
148152
*/
149-
@ServiceMethod(returns = ReturnType.SINGLE)
153+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
150154
SyncPoller<PollResult<CustomLocationInner>, CustomLocationInner> beginCreateOrUpdate(
151155
String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context);
152156

@@ -188,9 +192,9 @@ CustomLocationInner createOrUpdate(
188192
* @throws IllegalArgumentException thrown if parameters fail the validation.
189193
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
190194
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
191-
* @return the completion.
195+
* @return the {@link SyncPoller} for polling of long-running operation.
192196
*/
193-
@ServiceMethod(returns = ReturnType.SINGLE)
197+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
194198
SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String resourceName);
195199

196200
/**
@@ -202,9 +206,9 @@ CustomLocationInner createOrUpdate(
202206
* @throws IllegalArgumentException thrown if parameters fail the validation.
203207
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
204208
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
205-
* @return the completion.
209+
* @return the {@link SyncPoller} for polling of long-running operation.
206210
*/
207-
@ServiceMethod(returns = ReturnType.SINGLE)
211+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
208212
SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String resourceName, Context context);
209213

210214
/**
@@ -256,7 +260,7 @@ CustomLocationInner createOrUpdate(
256260
* @throws IllegalArgumentException thrown if parameters fail the validation.
257261
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
258262
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
259-
* @return custom Locations definition.
263+
* @return custom Locations definition along with {@link Response}.
260264
*/
261265
@ServiceMethod(returns = ReturnType.SINGLE)
262266
Response<CustomLocationInner> updateWithResponse(
@@ -270,7 +274,7 @@ Response<CustomLocationInner> updateWithResponse(
270274
* @throws IllegalArgumentException thrown if parameters fail the validation.
271275
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
272276
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
273-
* @return the list of the Enabled Resource Types.
277+
* @return the list of the Enabled Resource Types as paginated response with {@link PagedIterable}.
274278
*/
275279
@ServiceMethod(returns = ReturnType.COLLECTION)
276280
PagedIterable<EnabledResourceTypeInner> listEnabledResourceTypes(String resourceGroupName, String resourceName);
@@ -284,7 +288,7 @@ Response<CustomLocationInner> updateWithResponse(
284288
* @throws IllegalArgumentException thrown if parameters fail the validation.
285289
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
286290
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
287-
* @return the list of the Enabled Resource Types.
291+
* @return the list of the Enabled Resource Types as paginated response with {@link PagedIterable}.
288292
*/
289293
@ServiceMethod(returns = ReturnType.COLLECTION)
290294
PagedIterable<EnabledResourceTypeInner> listEnabledResourceTypes(

sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationInner.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,16 @@
77
import com.azure.core.annotation.Fluent;
88
import com.azure.core.management.Resource;
99
import com.azure.core.management.SystemData;
10-
import com.azure.core.util.logging.ClientLogger;
1110
import com.azure.resourcemanager.extendedlocation.models.CustomLocationPropertiesAuthentication;
1211
import com.azure.resourcemanager.extendedlocation.models.HostType;
1312
import com.azure.resourcemanager.extendedlocation.models.Identity;
14-
import com.fasterxml.jackson.annotation.JsonIgnore;
1513
import com.fasterxml.jackson.annotation.JsonProperty;
1614
import java.util.List;
1715
import java.util.Map;
1816

1917
/** Custom Locations definition. */
2018
@Fluent
2119
public final class CustomLocationInner extends Resource {
22-
@JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationInner.class);
23-
2420
/*
2521
* Identity for the resource.
2622
*/

sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationOperationInner.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
package com.azure.resourcemanager.extendedlocation.fluent.models;
66

77
import com.azure.core.annotation.Fluent;
8-
import com.azure.core.util.logging.ClientLogger;
9-
import com.fasterxml.jackson.annotation.JsonIgnore;
108
import com.fasterxml.jackson.annotation.JsonProperty;
119

1210
/** Custom Locations operation. */
1311
@Fluent
1412
public final class CustomLocationOperationInner {
15-
@JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationOperationInner.class);
16-
1713
/*
1814
* Describes the properties of a Custom Locations Operation Value Display.
1915
*/

sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationOperationValueDisplay.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
package com.azure.resourcemanager.extendedlocation.fluent.models;
66

77
import com.azure.core.annotation.Immutable;
8-
import com.azure.core.util.logging.ClientLogger;
9-
import com.fasterxml.jackson.annotation.JsonIgnore;
108
import com.fasterxml.jackson.annotation.JsonProperty;
119

1210
/** Describes the properties of a Custom Locations Operation Value Display. */
1311
@Immutable
1412
public final class CustomLocationOperationValueDisplay {
15-
@JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationOperationValueDisplay.class);
16-
1713
/*
1814
* The description of the operation.
1915
*/

sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationProperties.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@
55
package com.azure.resourcemanager.extendedlocation.fluent.models;
66

77
import com.azure.core.annotation.Fluent;
8-
import com.azure.core.util.logging.ClientLogger;
98
import com.azure.resourcemanager.extendedlocation.models.CustomLocationPropertiesAuthentication;
109
import com.azure.resourcemanager.extendedlocation.models.HostType;
11-
import com.fasterxml.jackson.annotation.JsonIgnore;
1210
import com.fasterxml.jackson.annotation.JsonProperty;
1311
import java.util.List;
1412

1513
/** Properties for a custom location. */
1614
@Fluent
1715
public final class CustomLocationProperties {
18-
@JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationProperties.class);
19-
2016
/*
2117
* This is optional input that contains the authentication that should be
2218
* used to generate the namespace.

0 commit comments

Comments
 (0)