Skip to content

Commit b4a48e4

Browse files
author
SDKAuto
committed
CodeGen from PR 21690 in Azure/azure-rest-api-specs
Merge 1af201c99053c218b4f747123b5f2e402bc1338d into cb6219f411b14e368af6175587b302ac74b4263d
1 parent 39a1607 commit b4a48e4

26 files changed

+288
-240
lines changed

sdk/resourcehealth/azure-resourcemanager-resourcehealth/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.3 (Unreleased)
3+
## 1.0.0-beta.1 (2022-12-01)
4+
5+
- Azure Resource Manager ResourceHealth client library for Java. This package contains Microsoft Azure SDK for ResourceHealth Management SDK. The Resource Health Client. Package tag package-2020-05-01. 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/resourcehealth/azure-resourcemanager-resourcehealth/README.md

Lines changed: 14 additions & 11 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-resourcehealth</artifactId>
35-
<version>1.0.0-beta.2</version>
35+
<version>1.0.0-beta.3</version>
3636
</dependency>
3737
```
3838
[//]: # ({x-version-update-end})
@@ -41,19 +41,19 @@ Various documentation is available to help you get started
4141

4242
Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client.
4343

44-
[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation.
44+
[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation.
4545

4646
### Authentication
4747

48-
By default, Azure Active Directory token authentication depends on correct configure of following environment variables.
48+
By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables.
4949

5050
- `AZURE_CLIENT_ID` for Azure client ID.
5151
- `AZURE_TENANT_ID` for Azure tenant ID.
5252
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.
5353

54-
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
54+
In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.
5555

56-
With above configuration, `azure` client can be authenticated by following code:
56+
With above configuration, `azure` client can be authenticated using the following code:
5757

5858
```java
5959
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
@@ -83,13 +83,13 @@ See [API design][design] for general introduction on design and key concepts on
8383

8484
## Contributing
8585

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

88-
1. Fork it
89-
1. Create your feature branch (`git checkout -b my-new-feature`)
90-
1. Commit your changes (`git commit -am 'Add some feature'`)
91-
1. Push to the branch (`git push origin my-new-feature`)
92-
1. Create new Pull Request
88+
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit <https://cla.microsoft.com>.
89+
90+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
91+
92+
This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact <[email protected]> with any additional questions or comments.
9393

9494
<!-- LINKS -->
9595
[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
@@ -100,3 +100,6 @@ For details on contributing to this repository, see the [contributing guide](htt
100100
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
101101
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
102102
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md
103+
[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md
104+
[coc]: https://opensource.microsoft.com/codeofconduct/
105+
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/

sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/ResourceHealthManager.java

Lines changed: 46 additions & 4 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;
@@ -67,6 +69,19 @@ public static ResourceHealthManager authenticate(TokenCredential credential, Azu
6769
return configure().authenticate(credential, profile);
6870
}
6971

72+
/**
73+
* Creates an instance of ResourceHealth service API entry point.
74+
*
75+
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
76+
* @param profile the Azure profile for client.
77+
* @return the ResourceHealth service API instance.
78+
*/
79+
public static ResourceHealthManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
80+
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
81+
Objects.requireNonNull(profile, "'profile' cannot be null.");
82+
return new ResourceHealthManager(httpPipeline, profile, null);
83+
}
84+
7085
/**
7186
* Gets a Configurable instance that can be used to create ResourceHealthManager with optional configuration.
7287
*
@@ -85,6 +100,7 @@ public static final class Configurable {
85100
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
86101
private final List<String> scopes = new ArrayList<>();
87102
private RetryPolicy retryPolicy;
103+
private RetryOptions retryOptions;
88104
private Duration defaultPollInterval;
89105

90106
private Configurable() {
@@ -145,6 +161,19 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
145161
return this;
146162
}
147163

164+
/**
165+
* Sets the retry options for the HTTP pipeline retry policy.
166+
*
167+
* <p>This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
168+
*
169+
* @param retryOptions the retry options for the HTTP pipeline retry policy.
170+
* @return the configurable object itself.
171+
*/
172+
public Configurable withRetryOptions(RetryOptions retryOptions) {
173+
this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
174+
return this;
175+
}
176+
148177
/**
149178
* Sets the default poll interval, used when service does not provide "Retry-After" header.
150179
*
@@ -178,7 +207,7 @@ public ResourceHealthManager authenticate(TokenCredential credential, AzureProfi
178207
.append("-")
179208
.append("com.azure.resourcemanager.resourcehealth")
180209
.append("/")
181-
.append("1.0.0-beta.2");
210+
.append("1.0.0-beta.1");
182211
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
183212
userAgentBuilder
184213
.append(" (")
@@ -196,10 +225,15 @@ public ResourceHealthManager authenticate(TokenCredential credential, AzureProfi
196225
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
197226
}
198227
if (retryPolicy == null) {
199-
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
228+
if (retryOptions != null) {
229+
retryPolicy = new RetryPolicy(retryOptions);
230+
} else {
231+
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
232+
}
200233
}
201234
List<HttpPipelinePolicy> policies = new ArrayList<>();
202235
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
236+
policies.add(new AddHeadersFromContextPolicy());
203237
policies.add(new RequestIdPolicy());
204238
policies
205239
.addAll(
@@ -230,15 +264,23 @@ public ResourceHealthManager authenticate(TokenCredential credential, AzureProfi
230264
}
231265
}
232266

233-
/** @return Resource collection API of AvailabilityStatuses. */
267+
/**
268+
* Gets the resource collection API of AvailabilityStatuses.
269+
*
270+
* @return Resource collection API of AvailabilityStatuses.
271+
*/
234272
public AvailabilityStatuses availabilityStatuses() {
235273
if (this.availabilityStatuses == null) {
236274
this.availabilityStatuses = new AvailabilityStatusesImpl(clientObject.getAvailabilityStatuses(), this);
237275
}
238276
return availabilityStatuses;
239277
}
240278

241-
/** @return Resource collection API of Operations. */
279+
/**
280+
* Gets the resource collection API of Operations.
281+
*
282+
* @return Resource collection API of Operations.
283+
*/
242284
public Operations operations() {
243285
if (this.operations == null) {
244286
this.operations = new OperationsImpl(clientObject.getOperations(), this);

sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/AvailabilityStatusesClient.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,18 @@ PagedIterable<AvailabilityStatusInner> listByResourceGroup(
7575
* /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}
7676
* and
7777
* /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}.
78+
* @param filter The filter to apply on the operation. For more information please see
79+
* https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN.
80+
* @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response.
81+
* @param context The context to associate with this operation.
7882
* @throws IllegalArgumentException thrown if parameters fail the validation.
7983
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
8084
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
81-
* @return current availability status for a single resource.
85+
* @return current availability status for a single resource along with {@link Response}.
8286
*/
8387
@ServiceMethod(returns = ReturnType.SINGLE)
84-
AvailabilityStatusInner getByResource(String resourceUri);
88+
Response<AvailabilityStatusInner> getByResourceWithResponse(
89+
String resourceUri, String filter, String expand, Context context);
8590

8691
/**
8792
* Gets current availability status for a single resource.
@@ -91,18 +96,13 @@ PagedIterable<AvailabilityStatusInner> listByResourceGroup(
9196
* /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}
9297
* and
9398
* /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}.
94-
* @param filter The filter to apply on the operation. For more information please see
95-
* https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN.
96-
* @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response.
97-
* @param context The context to associate with this operation.
9899
* @throws IllegalArgumentException thrown if parameters fail the validation.
99100
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
100101
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
101-
* @return current availability status for a single resource along with {@link Response}.
102+
* @return current availability status for a single resource.
102103
*/
103104
@ServiceMethod(returns = ReturnType.SINGLE)
104-
Response<AvailabilityStatusInner> getByResourceWithResponse(
105-
String resourceUri, String filter, String expand, Context context);
105+
AvailabilityStatusInner getByResource(String resourceUri);
106106

107107
/**
108108
* Lists all historical availability transitions and impacting events for a single resource.

sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/OperationsClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ public interface OperationsClient {
1515
/**
1616
* Lists available operations for the resourcehealth resource provider.
1717
*
18+
* @param context The context to associate with this operation.
19+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1820
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
1921
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
20-
* @return lists the operations response.
22+
* @return lists the operations response along with {@link Response}.
2123
*/
2224
@ServiceMethod(returns = ReturnType.SINGLE)
23-
OperationListResultInner list();
25+
Response<OperationListResultInner> listWithResponse(Context context);
2426

2527
/**
2628
* Lists available operations for the resourcehealth resource provider.
2729
*
28-
* @param context The context to associate with this operation.
29-
* @throws IllegalArgumentException thrown if parameters fail the validation.
3030
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
3131
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
32-
* @return lists the operations response along with {@link Response}.
32+
* @return lists the operations response.
3333
*/
3434
@ServiceMethod(returns = ReturnType.SINGLE)
35-
Response<OperationListResultInner> listWithResponse(Context context);
35+
OperationListResultInner list();
3636
}

sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/AvailabilityStatusInner.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public final class AvailabilityStatusInner {
4141
@JsonProperty(value = "properties")
4242
private AvailabilityStatusProperties properties;
4343

44+
/** Creates an instance of AvailabilityStatusInner class. */
45+
public AvailabilityStatusInner() {
46+
}
47+
4448
/**
4549
* Get the id property: Azure Resource Manager Identity for the availabilityStatuses resource.
4650
*

sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/OperationListResultInner.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public final class OperationListResultInner {
1919
@JsonProperty(value = "value", required = true)
2020
private List<Operation> value;
2121

22+
/** Creates an instance of OperationListResultInner class. */
23+
public OperationListResultInner() {
24+
}
25+
2226
/**
2327
* Get the value property: List of operations available in the resourcehealth resource provider.
2428
*

0 commit comments

Comments
 (0)