diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/CHANGELOG.md b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/CHANGELOG.md index d10214f5484f..24448d838831 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/CHANGELOG.md +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.1 (2022-12-05) + +- 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-preview-2022-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/README.md b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/README.md index 7ac493972ce9..442cc2fe17f4 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/README.md +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/README.md @@ -2,7 +2,7 @@ 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). +This package contains Microsoft Azure SDK for ResourceHealth Management SDK. The Resource Health Client. Package tag package-preview-2022-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-resourcehealth - 1.0.0-beta.2 + 1.0.0-beta.3 ``` [//]: # ({x-version-update-end}) @@ -41,19 +41,19 @@ Various documentation is available to help you get started Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. -[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. ### Authentication -By default, Azure Active Directory token authentication depends on correct configure of following environment variables. +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. - `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. -In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -With above configuration, `azure` client can be authenticated by following code: +With above configuration, `azure` client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -83,13 +83,13 @@ See [API design][design] for general introduction on design and key concepts on ## Contributing -For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). +For details on contributing to this repository, see the [contributing guide][cg]. -1. Fork it -1. Create your feature branch (`git checkout -b my-new-feature`) -1. Commit your changes (`git commit -am 'Add some feature'`) -1. Push to the branch (`git push origin my-new-feature`) -1. Create new Pull Request +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 . + +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. + +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 with any additional questions or comments. [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 [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty [authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md [design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/SAMPLE.md b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/SAMPLE.md index 1be5f265d1a5..aaacd2a4d31d 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/SAMPLE.md +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/SAMPLE.md @@ -8,6 +8,22 @@ - [ListByResourceGroup](#availabilitystatuses_listbyresourcegroup) - [ListBySubscriptionId](#availabilitystatuses_listbysubscriptionid) +## EventOperation + +- [GetBySubscriptionIdAndTrackingId](#eventoperation_getbysubscriptionidandtrackingid) +- [GetByTenantIdAndTrackingId](#eventoperation_getbytenantidandtrackingid) + +## EventsOperation + +- [List](#eventsoperation_list) +- [ListBySingleResource](#eventsoperation_listbysingleresource) +- [ListByTenantId](#eventsoperation_listbytenantid) + +## ImpactedResources + +- [Get](#impactedresources_get) +- [ListBySubscriptionIdAndEventId](#impactedresources_listbysubscriptionidandeventid) + ## Operations - [List](#operations_list) @@ -19,7 +35,7 @@ import com.azure.core.util.Context; /** Samples for AvailabilityStatuses GetByResource. */ public final class AvailabilityStatusesGetByResourceSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatus_GetByResource.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatus_GetByResource.json */ /** * Sample code: GetCurrentHealthByResource. @@ -43,7 +59,7 @@ import com.azure.core.util.Context; /** Samples for AvailabilityStatuses List. */ public final class AvailabilityStatusesListSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_List.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatuses_List.json */ /** * Sample code: GetHealthHistoryByResource. @@ -65,7 +81,7 @@ import com.azure.core.util.Context; /** Samples for AvailabilityStatuses ListByResourceGroup. */ public final class AvailabilityStatusesListByResourceGroupSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_ListByResourceGroup.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatuses_ListByResourceGroup.json */ /** * Sample code: ListByResourceGroup. @@ -88,7 +104,7 @@ import com.azure.core.util.Context; /** Samples for AvailabilityStatuses ListBySubscriptionId. */ public final class AvailabilityStatusesListBySubscriptionIdSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_ListBySubscriptionId.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatuses_ListBySubscriptionId.json */ /** * Sample code: ListHealthBySubscriptionId. @@ -102,6 +118,175 @@ public final class AvailabilityStatusesListBySubscriptionIdSamples { } ``` +### EventOperation_GetBySubscriptionIdAndTrackingId + +```java +import com.azure.core.util.Context; + +/** Samples for EventOperation GetBySubscriptionIdAndTrackingId. */ +public final class EventOperationGetBySubscriptionIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json + */ + /** + * Sample code: SecurityAdvisoriesEventBySubscriptionIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void securityAdvisoriesEventBySubscriptionIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .getBySubscriptionIdAndTrackingIdWithResponse( + "eventTrackingId", "properties/status eq 'Active'", "7/10/2022", Context.NONE); + } +} +``` + +### EventOperation_GetByTenantIdAndTrackingId + +```java +import com.azure.core.util.Context; + +/** Samples for EventOperation GetByTenantIdAndTrackingId. */ +public final class EventOperationGetByTenantIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json + */ + /** + * Sample code: EventByTenantIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventByTenantIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .getByTenantIdAndTrackingIdWithResponse( + "eventTrackingId", "properties/status eq 'Active'", "7/10/2022", Context.NONE); + } +} +``` + +### EventsOperation_List + +```java +import com.azure.core.util.Context; + +/** Samples for EventsOperation List. */ +public final class EventsOperationListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Events_ListBySubscriptionId.json + */ + /** + * Sample code: ListEventsBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .list("service eq 'Virtual Machines' or region eq 'West US'", "7/24/2020", Context.NONE); + } +} +``` + +### EventsOperation_ListBySingleResource + +```java +import com.azure.core.util.Context; + +/** Samples for EventsOperation ListBySingleResource. */ +public final class EventsOperationListBySingleResourceSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Events_ListBySingleResource.json + */ + /** + * Sample code: ListEventsBySingleResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsBySingleResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .listBySingleResource( + "subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI", + null, + Context.NONE); + } +} +``` + +### EventsOperation_ListByTenantId + +```java +import com.azure.core.util.Context; + +/** Samples for EventsOperation ListByTenantId. */ +public final class EventsOperationListByTenantIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Events_ListByTenantId.json + */ + /** + * Sample code: ListEventsByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsByTenantId(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .listByTenantId("service eq 'Virtual Machines' or region eq 'West US'", "7/24/2020", Context.NONE); + } +} +``` + +### ImpactedResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ImpactedResources Get. */ +public final class ImpactedResourcesGetSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_Get.json + */ + /** + * Sample code: ImpactedResourcesGet. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void impactedResourcesGet(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.impactedResources().getWithResponse("BC_1-FXZ", "abc-123-ghj-456", Context.NONE); + } +} +``` + +### ImpactedResources_ListBySubscriptionIdAndEventId + +```java +import com.azure.core.util.Context; + +/** Samples for ImpactedResources ListBySubscriptionIdAndEventId. */ +public final class ImpactedResourcesListBySubscriptionIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json + */ + /** + * Sample code: ListImpactedResourcesBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listImpactedResourcesBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .listBySubscriptionIdAndEventId("BC_1-FXZ", "targetRegion eq 'westus'", Context.NONE); + } +} +``` + ### Operations_List ```java @@ -110,15 +295,14 @@ import com.azure.core.util.Context; /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/Operations_List.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Operations_List.json */ /** - * Sample code: GetHealthHistoryByResource. + * Sample code: GetOperationsList. * * @param manager Entry point to ResourceHealthManager. */ - public static void getHealthHistoryByResource( - com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + public static void getOperationsList(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { manager.operations().listWithResponse(Context.NONE); } } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml index 2f474bb0eb5a..7511cd3914d6 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for ResourceHealth Management - This package contains Microsoft Azure SDK for ResourceHealth Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Resource Health Client. Package tag package-2020-05-01. + This package contains Microsoft Azure SDK for ResourceHealth Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Resource Health Client. Package tag package-preview-2022-10. https://github.com/Azure/azure-sdk-for-java @@ -39,9 +39,6 @@ UTF-8 true - - --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - @@ -55,40 +52,40 @@ 1.9.0 - com.azure - azure-core-test - 1.13.0 - test + com.azure + azure-core-test + 1.13.0 + test - com.azure - azure-identity - 1.7.1 - test + com.azure + azure-identity + 1.7.1 + test - org.junit.jupiter - junit-jupiter-api - 5.9.1 - test + org.junit.jupiter + junit-jupiter-api + 5.9.1 + test - org.junit.jupiter - junit-jupiter-engine - 5.9.1 - test + org.junit.jupiter + junit-jupiter-engine + 5.9.1 + test - com.azure.resourcemanager - azure-resourcemanager-compute - 2.21.0 - test + com.azure.resourcemanager + azure-resourcemanager-compute + 2.21.0 + test - org.slf4j - slf4j-simple - 1.7.36 - test + org.slf4j + slf4j-simple + 1.7.36 + test diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/ResourceHealthManager.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/ResourceHealthManager.java index 5f2401f33050..453ca0ee326b 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/ResourceHealthManager.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/ResourceHealthManager.java @@ -10,11 +10,13 @@ import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; @@ -23,9 +25,15 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.resourcehealth.fluent.MicrosoftResourceHealth; import com.azure.resourcemanager.resourcehealth.implementation.AvailabilityStatusesImpl; +import com.azure.resourcemanager.resourcehealth.implementation.EventOperationsImpl; +import com.azure.resourcemanager.resourcehealth.implementation.EventsOperationsImpl; +import com.azure.resourcemanager.resourcehealth.implementation.ImpactedResourcesImpl; import com.azure.resourcemanager.resourcehealth.implementation.MicrosoftResourceHealthBuilder; import com.azure.resourcemanager.resourcehealth.implementation.OperationsImpl; import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatuses; +import com.azure.resourcemanager.resourcehealth.models.EventOperations; +import com.azure.resourcemanager.resourcehealth.models.EventsOperations; +import com.azure.resourcemanager.resourcehealth.models.ImpactedResources; import com.azure.resourcemanager.resourcehealth.models.Operations; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -40,6 +48,12 @@ public final class ResourceHealthManager { private Operations operations; + private ImpactedResources impactedResources; + + private EventsOperations eventsOperations; + + private EventOperations eventOperations; + private final MicrosoftResourceHealth clientObject; private ResourceHealthManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -67,6 +81,19 @@ public static ResourceHealthManager authenticate(TokenCredential credential, Azu return configure().authenticate(credential, profile); } + /** + * Creates an instance of ResourceHealth service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ResourceHealth service API instance. + */ + public static ResourceHealthManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ResourceHealthManager(httpPipeline, profile, null); + } + /** * Gets a Configurable instance that can be used to create ResourceHealthManager with optional configuration. * @@ -85,6 +112,7 @@ public static final class Configurable { private final List policies = new ArrayList<>(); private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; + private RetryOptions retryOptions; private Duration defaultPollInterval; private Configurable() { @@ -145,6 +173,19 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { return this; } + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + /** * Sets the default poll interval, used when service does not provide "Retry-After" header. * @@ -178,7 +219,7 @@ public ResourceHealthManager authenticate(TokenCredential credential, AzureProfi .append("-") .append("com.azure.resourcemanager.resourcehealth") .append("/") - .append("1.0.0-beta.2"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -196,10 +237,15 @@ public ResourceHealthManager authenticate(TokenCredential credential, AzureProfi scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); } if (retryPolicy == null) { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } } List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); policies.add(new RequestIdPolicy()); policies .addAll( @@ -230,7 +276,11 @@ public ResourceHealthManager authenticate(TokenCredential credential, AzureProfi } } - /** @return Resource collection API of AvailabilityStatuses. */ + /** + * Gets the resource collection API of AvailabilityStatuses. + * + * @return Resource collection API of AvailabilityStatuses. + */ public AvailabilityStatuses availabilityStatuses() { if (this.availabilityStatuses == null) { this.availabilityStatuses = new AvailabilityStatusesImpl(clientObject.getAvailabilityStatuses(), this); @@ -238,7 +288,11 @@ public AvailabilityStatuses availabilityStatuses() { return availabilityStatuses; } - /** @return Resource collection API of Operations. */ + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ public Operations operations() { if (this.operations == null) { this.operations = new OperationsImpl(clientObject.getOperations(), this); @@ -246,6 +300,42 @@ public Operations operations() { return operations; } + /** + * Gets the resource collection API of ImpactedResources. + * + * @return Resource collection API of ImpactedResources. + */ + public ImpactedResources impactedResources() { + if (this.impactedResources == null) { + this.impactedResources = new ImpactedResourcesImpl(clientObject.getImpactedResources(), this); + } + return impactedResources; + } + + /** + * Gets the resource collection API of EventsOperations. + * + * @return Resource collection API of EventsOperations. + */ + public EventsOperations eventsOperations() { + if (this.eventsOperations == null) { + this.eventsOperations = new EventsOperationsImpl(clientObject.getEventsOperations(), this); + } + return eventsOperations; + } + + /** + * Gets the resource collection API of EventOperations. + * + * @return Resource collection API of EventOperations. + */ + public EventOperations eventOperations() { + if (this.eventOperations == null) { + this.eventOperations = new EventOperationsImpl(clientObject.getEventOperations(), this); + } + return eventOperations; + } + /** * @return Wrapped service client MicrosoftResourceHealth providing direct access to the underlying auto-generated * API implementation, based on Azure REST API. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/AvailabilityStatusesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/AvailabilityStatusesClient.java index c0c086b78c5f..27511c536c39 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/AvailabilityStatusesClient.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/AvailabilityStatusesClient.java @@ -75,13 +75,18 @@ PagedIterable listByResourceGroup( * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} * and * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return current availability status for a single resource. + * @return current availability status for a single resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - AvailabilityStatusInner getByResource(String resourceUri); + Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context); /** * Gets current availability status for a single resource. @@ -91,18 +96,13 @@ PagedIterable listByResourceGroup( * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} * and * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - * @param filter The filter to apply on the operation. For more information please see - * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return current availability status for a single resource along with {@link Response}. + * @return current availability status for a single resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceWithResponse( - String resourceUri, String filter, String expand, Context context); + AvailabilityStatusInner getByResource(String resourceUri); /** * Lists all historical availability transitions and impacting events for a single resource. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventOperationsClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventOperationsClient.java new file mode 100644 index 000000000000..c75bc2463a38 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventOperationsClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; + +/** An instance of this class provides access to all the operations defined in EventOperationsClient. */ +public interface EventOperationsClient { + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context); + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventInner getBySubscriptionIdAndTrackingId(String eventTrackingId); + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context); + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventInner getByTenantIdAndTrackingId(String eventTrackingId); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventsOperationsClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventsOperationsClient.java new file mode 100644 index 000000000000..22a2c066f8b9 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventsOperationsClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; + +/** An instance of this class provides access to all the operations defined in EventsOperationsClient. */ +public interface EventsOperationsClient { + /** + * Lists service health events in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, String queryStartTime, Context context); + + /** + * Lists current service health events in the tenant. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTenantId(); + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTenantId(String filter, String queryStartTime, Context context); + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySingleResource(String resourceUri); + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySingleResource(String resourceUri, String filter, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ImpactedResourcesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ImpactedResourcesClient.java new file mode 100644 index 000000000000..97d0ac3f3f46 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ImpactedResourcesClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; + +/** An instance of this class provides access to all the operations defined in ImpactedResourcesClient. */ +public interface ImpactedResourcesClient { + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String eventTrackingId, String impactedResourceName, Context context); + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventImpactedResourceInner get(String eventTrackingId, String impactedResourceName); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MicrosoftResourceHealth.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MicrosoftResourceHealth.java index dad8232c60aa..0ff91b71c504 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MicrosoftResourceHealth.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MicrosoftResourceHealth.java @@ -10,8 +10,7 @@ /** The interface for MicrosoftResourceHealth class. */ public interface MicrosoftResourceHealth { /** - * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. + * Gets The ID of the target subscription. * * @return the subscriptionId value. */ @@ -58,4 +57,25 @@ public interface MicrosoftResourceHealth { * @return the OperationsClient object. */ OperationsClient getOperations(); + + /** + * Gets the ImpactedResourcesClient object to access its operations. + * + * @return the ImpactedResourcesClient object. + */ + ImpactedResourcesClient getImpactedResources(); + + /** + * Gets the EventsOperationsClient object to access its operations. + * + * @return the EventsOperationsClient object. + */ + EventsOperationsClient getEventsOperations(); + + /** + * Gets the EventOperationsClient object to access its operations. + * + * @return the EventOperationsClient object. + */ + EventOperationsClient getEventOperations(); } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/OperationsClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/OperationsClient.java index da83d0af2b67..3d67f564748b 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/OperationsClient.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/OperationsClient.java @@ -15,22 +15,22 @@ public interface OperationsClient { /** * Lists available operations for the resourcehealth resource provider. * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return lists the operations response. + * @return lists the operations response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - OperationListResultInner list(); + Response listWithResponse(Context context); /** * Lists available operations for the resourcehealth resource provider. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return lists the operations response along with {@link Response}. + * @return lists the operations response. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response listWithResponse(Context context); + OperationListResultInner list(); } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/AvailabilityStatusInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/AvailabilityStatusInner.java index 6b0d94060095..df325e2a2fc9 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/AvailabilityStatusInner.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/AvailabilityStatusInner.java @@ -41,6 +41,10 @@ public final class AvailabilityStatusInner { @JsonProperty(value = "properties") private AvailabilityStatusProperties properties; + /** Creates an instance of AvailabilityStatusInner class. */ + public AvailabilityStatusInner() { + } + /** * Get the id property: Azure Resource Manager Identity for the availabilityStatuses resource. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceInner.java new file mode 100644 index 000000000000..c5e64558d147 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.models.KeyValueItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Impacted resource for an event. */ +@Fluent +public final class EventImpactedResourceInner extends ProxyResource { + /* + * Properties of impacted resource. + */ + @JsonProperty(value = "properties") + private EventImpactedResourceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of EventImpactedResourceInner class. */ + public EventImpactedResourceInner() { + } + + /** + * Get the innerProperties property: Properties of impacted resource. + * + * @return the innerProperties value. + */ + private EventImpactedResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the targetResourceType property: Resource type within Microsoft cloud. + * + * @return the targetResourceType value. + */ + public String targetResourceType() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceType(); + } + + /** + * Get the targetResourceId property: Identity for resource within Microsoft cloud. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceId(); + } + + /** + * Get the targetRegion property: Impacted resource region name. + * + * @return the targetRegion value. + */ + public String targetRegion() { + return this.innerProperties() == null ? null : this.innerProperties().targetRegion(); + } + + /** + * Get the info property: Additional information. + * + * @return the info value. + */ + public List info() { + return this.innerProperties() == null ? null : this.innerProperties().info(); + } + + /** + * Set the info property: Additional information. + * + * @param info the info value to set. + * @return the EventImpactedResourceInner object itself. + */ + public EventImpactedResourceInner withInfo(List info) { + if (this.innerProperties() == null) { + this.innerProperties = new EventImpactedResourceProperties(); + } + this.innerProperties().withInfo(info); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceProperties.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceProperties.java new file mode 100644 index 000000000000..8aad65ba8a29 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceProperties.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.resourcehealth.models.KeyValueItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of impacted resource. */ +@Fluent +public final class EventImpactedResourceProperties { + /* + * Resource type within Microsoft cloud. + */ + @JsonProperty(value = "targetResourceType", access = JsonProperty.Access.WRITE_ONLY) + private String targetResourceType; + + /* + * Identity for resource within Microsoft cloud. + */ + @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String targetResourceId; + + /* + * Impacted resource region name. + */ + @JsonProperty(value = "targetRegion", access = JsonProperty.Access.WRITE_ONLY) + private String targetRegion; + + /* + * Additional information. + */ + @JsonProperty(value = "info") + private List info; + + /** Creates an instance of EventImpactedResourceProperties class. */ + public EventImpactedResourceProperties() { + } + + /** + * Get the targetResourceType property: Resource type within Microsoft cloud. + * + * @return the targetResourceType value. + */ + public String targetResourceType() { + return this.targetResourceType; + } + + /** + * Get the targetResourceId property: Identity for resource within Microsoft cloud. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Get the targetRegion property: Impacted resource region name. + * + * @return the targetRegion value. + */ + public String targetRegion() { + return this.targetRegion; + } + + /** + * Get the info property: Additional information. + * + * @return the info value. + */ + public List info() { + return this.info; + } + + /** + * Set the info property: Additional information. + * + * @param info the info value to set. + * @return the EventImpactedResourceProperties object itself. + */ + public EventImpactedResourceProperties withInfo(List info) { + this.info = info; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (info() != null) { + info().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventInner.java new file mode 100644 index 000000000000..b9915790372f --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventInner.java @@ -0,0 +1,701 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.models.EventLevelValues; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesAdditionalInformation; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesArticle; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesRecommendedActions; +import com.azure.resourcemanager.resourcehealth.models.EventSourceValues; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.EventTypeValues; +import com.azure.resourcemanager.resourcehealth.models.Faq; +import com.azure.resourcemanager.resourcehealth.models.Impact; +import com.azure.resourcemanager.resourcehealth.models.LevelValues; +import com.azure.resourcemanager.resourcehealth.models.Link; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Service health event. */ +@Fluent +public final class EventInner extends ProxyResource { + /* + * Properties of event. + */ + @JsonProperty(value = "properties") + private EventProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of EventInner class. */ + public EventInner() { + } + + /** + * Get the innerProperties property: Properties of event. + * + * @return the innerProperties value. + */ + private EventProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the eventType property: Type of event. + * + * @return the eventType value. + */ + public EventTypeValues eventType() { + return this.innerProperties() == null ? null : this.innerProperties().eventType(); + } + + /** + * Set the eventType property: Type of event. + * + * @param eventType the eventType value to set. + * @return the EventInner object itself. + */ + public EventInner withEventType(EventTypeValues eventType) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEventType(eventType); + return this; + } + + /** + * Get the eventSource property: Source of event. + * + * @return the eventSource value. + */ + public EventSourceValues eventSource() { + return this.innerProperties() == null ? null : this.innerProperties().eventSource(); + } + + /** + * Set the eventSource property: Source of event. + * + * @param eventSource the eventSource value to set. + * @return the EventInner object itself. + */ + public EventInner withEventSource(EventSourceValues eventSource) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEventSource(eventSource); + return this; + } + + /** + * Get the status property: Current status of event. + * + * @return the status value. + */ + public EventStatusValues status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: Current status of event. + * + * @param status the status value to set. + * @return the EventInner object itself. + */ + public EventInner withStatus(EventStatusValues status) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the title property: Title text of event. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: Title text of event. + * + * @param title the title value to set. + * @return the EventInner object itself. + */ + public EventInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the summary property: Summary text of event. + * + * @return the summary value. + */ + public String summary() { + return this.innerProperties() == null ? null : this.innerProperties().summary(); + } + + /** + * Set the summary property: Summary text of event. + * + * @param summary the summary value to set. + * @return the EventInner object itself. + */ + public EventInner withSummary(String summary) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withSummary(summary); + return this; + } + + /** + * Get the headerProperty property: Header text of event. + * + * @return the headerProperty value. + */ + public String headerProperty() { + return this.innerProperties() == null ? null : this.innerProperties().headerProperty(); + } + + /** + * Set the headerProperty property: Header text of event. + * + * @param headerProperty the headerProperty value to set. + * @return the EventInner object itself. + */ + public EventInner withHeaderProperty(String headerProperty) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withHeaderProperty(headerProperty); + return this; + } + + /** + * Get the level property: Level of insight. + * + * @return the level value. + */ + public LevelValues level() { + return this.innerProperties() == null ? null : this.innerProperties().level(); + } + + /** + * Set the level property: Level of insight. + * + * @param level the level value to set. + * @return the EventInner object itself. + */ + public EventInner withLevel(LevelValues level) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withLevel(level); + return this; + } + + /** + * Get the eventLevel property: Level of event. + * + * @return the eventLevel value. + */ + public EventLevelValues eventLevel() { + return this.innerProperties() == null ? null : this.innerProperties().eventLevel(); + } + + /** + * Set the eventLevel property: Level of event. + * + * @param eventLevel the eventLevel value to set. + * @return the EventInner object itself. + */ + public EventInner withEventLevel(EventLevelValues eventLevel) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEventLevel(eventLevel); + return this; + } + + /** + * Get the externalIncidentId property: The id of the Incident. + * + * @return the externalIncidentId value. + */ + public String externalIncidentId() { + return this.innerProperties() == null ? null : this.innerProperties().externalIncidentId(); + } + + /** + * Set the externalIncidentId property: The id of the Incident. + * + * @param externalIncidentId the externalIncidentId value to set. + * @return the EventInner object itself. + */ + public EventInner withExternalIncidentId(String externalIncidentId) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withExternalIncidentId(externalIncidentId); + return this; + } + + /** + * Get the article property: Article of event. + * + * @return the article value. + */ + public EventPropertiesArticle article() { + return this.innerProperties() == null ? null : this.innerProperties().article(); + } + + /** + * Set the article property: Article of event. + * + * @param article the article value to set. + * @return the EventInner object itself. + */ + public EventInner withArticle(EventPropertiesArticle article) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withArticle(article); + return this; + } + + /** + * Get the links property: Useful links of event. + * + * @return the links value. + */ + public List links() { + return this.innerProperties() == null ? null : this.innerProperties().links(); + } + + /** + * Set the links property: Useful links of event. + * + * @param links the links value to set. + * @return the EventInner object itself. + */ + public EventInner withLinks(List links) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withLinks(links); + return this; + } + + /** + * Get the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @return the impactStartTime value. + */ + public OffsetDateTime impactStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().impactStartTime(); + } + + /** + * Set the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @param impactStartTime the impactStartTime value to set. + * @return the EventInner object itself. + */ + public EventInner withImpactStartTime(OffsetDateTime impactStartTime) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withImpactStartTime(impactStartTime); + return this; + } + + /** + * Get the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @return the impactMitigationTime value. + */ + public OffsetDateTime impactMitigationTime() { + return this.innerProperties() == null ? null : this.innerProperties().impactMitigationTime(); + } + + /** + * Set the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @param impactMitigationTime the impactMitigationTime value to set. + * @return the EventInner object itself. + */ + public EventInner withImpactMitigationTime(OffsetDateTime impactMitigationTime) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withImpactMitigationTime(impactMitigationTime); + return this; + } + + /** + * Get the impact property: List services impacted by the service health event. + * + * @return the impact value. + */ + public List impact() { + return this.innerProperties() == null ? null : this.innerProperties().impact(); + } + + /** + * Set the impact property: List services impacted by the service health event. + * + * @param impact the impact value to set. + * @return the EventInner object itself. + */ + public EventInner withImpact(List impact) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withImpact(impact); + return this; + } + + /** + * Get the recommendedActions property: Recommended actions of event. + * + * @return the recommendedActions value. + */ + public EventPropertiesRecommendedActions recommendedActions() { + return this.innerProperties() == null ? null : this.innerProperties().recommendedActions(); + } + + /** + * Set the recommendedActions property: Recommended actions of event. + * + * @param recommendedActions the recommendedActions value to set. + * @return the EventInner object itself. + */ + public EventInner withRecommendedActions(EventPropertiesRecommendedActions recommendedActions) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withRecommendedActions(recommendedActions); + return this; + } + + /** + * Get the faqs property: Frequently asked questions for the service health event. + * + * @return the faqs value. + */ + public List faqs() { + return this.innerProperties() == null ? null : this.innerProperties().faqs(); + } + + /** + * Set the faqs property: Frequently asked questions for the service health event. + * + * @param faqs the faqs value to set. + * @return the EventInner object itself. + */ + public EventInner withFaqs(List faqs) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withFaqs(faqs); + return this; + } + + /** + * Get the isHir property: It provides information if the event is High incident rate event or not. + * + * @return the isHir value. + */ + public Boolean isHir() { + return this.innerProperties() == null ? null : this.innerProperties().isHir(); + } + + /** + * Set the isHir property: It provides information if the event is High incident rate event or not. + * + * @param isHir the isHir value to set. + * @return the EventInner object itself. + */ + public EventInner withIsHir(Boolean isHir) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withIsHir(isHir); + return this; + } + + /** + * Get the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableMicrosoftSupport value. + */ + public Boolean enableMicrosoftSupport() { + return this.innerProperties() == null ? null : this.innerProperties().enableMicrosoftSupport(); + } + + /** + * Set the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @param enableMicrosoftSupport the enableMicrosoftSupport value to set. + * @return the EventInner object itself. + */ + public EventInner withEnableMicrosoftSupport(Boolean enableMicrosoftSupport) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEnableMicrosoftSupport(enableMicrosoftSupport); + return this; + } + + /** + * Get the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @param description the description value to set. + * @return the EventInner object itself. + */ + public EventInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the platformInitiated property: Is true if the event is platform initiated. + * + * @return the platformInitiated value. + */ + public Boolean platformInitiated() { + return this.innerProperties() == null ? null : this.innerProperties().platformInitiated(); + } + + /** + * Set the platformInitiated property: Is true if the event is platform initiated. + * + * @param platformInitiated the platformInitiated value to set. + * @return the EventInner object itself. + */ + public EventInner withPlatformInitiated(Boolean platformInitiated) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withPlatformInitiated(platformInitiated); + return this; + } + + /** + * Get the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableChatWithUs value. + */ + public Boolean enableChatWithUs() { + return this.innerProperties() == null ? null : this.innerProperties().enableChatWithUs(); + } + + /** + * Set the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @param enableChatWithUs the enableChatWithUs value to set. + * @return the EventInner object itself. + */ + public EventInner withEnableChatWithUs(Boolean enableChatWithUs) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEnableChatWithUs(enableChatWithUs); + return this; + } + + /** + * Get the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @return the priority value. + */ + public Integer priority() { + return this.innerProperties() == null ? null : this.innerProperties().priority(); + } + + /** + * Set the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @param priority the priority value to set. + * @return the EventInner object itself. + */ + public EventInner withPriority(Integer priority) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withPriority(priority); + return this; + } + + /** + * Get the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateTime(); + } + + /** + * Set the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @param lastUpdateTime the lastUpdateTime value to set. + * @return the EventInner object itself. + */ + public EventInner withLastUpdateTime(OffsetDateTime lastUpdateTime) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withLastUpdateTime(lastUpdateTime); + return this; + } + + /** + * Get the hirStage property: Stage for HIR Document. + * + * @return the hirStage value. + */ + public String hirStage() { + return this.innerProperties() == null ? null : this.innerProperties().hirStage(); + } + + /** + * Set the hirStage property: Stage for HIR Document. + * + * @param hirStage the hirStage value to set. + * @return the EventInner object itself. + */ + public EventInner withHirStage(String hirStage) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withHirStage(hirStage); + return this; + } + + /** + * Get the additionalInformation property: Additional information. + * + * @return the additionalInformation value. + */ + public EventPropertiesAdditionalInformation additionalInformation() { + return this.innerProperties() == null ? null : this.innerProperties().additionalInformation(); + } + + /** + * Set the additionalInformation property: Additional information. + * + * @param additionalInformation the additionalInformation value to set. + * @return the EventInner object itself. + */ + public EventInner withAdditionalInformation(EventPropertiesAdditionalInformation additionalInformation) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withAdditionalInformation(additionalInformation); + return this; + } + + /** + * Get the duration property: duration in seconds. + * + * @return the duration value. + */ + public Integer duration() { + return this.innerProperties() == null ? null : this.innerProperties().duration(); + } + + /** + * Set the duration property: duration in seconds. + * + * @param duration the duration value to set. + * @return the EventInner object itself. + */ + public EventInner withDuration(Integer duration) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withDuration(duration); + return this; + } + + /** + * Get the impactType property: The type of the impact. + * + * @return the impactType value. + */ + public String impactType() { + return this.innerProperties() == null ? null : this.innerProperties().impactType(); + } + + /** + * Set the impactType property: The type of the impact. + * + * @param impactType the impactType value to set. + * @return the EventInner object itself. + */ + public EventInner withImpactType(String impactType) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withImpactType(impactType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventProperties.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventProperties.java new file mode 100644 index 000000000000..d3b694ecab33 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventProperties.java @@ -0,0 +1,767 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.resourcehealth.models.EventLevelValues; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesAdditionalInformation; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesArticle; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesRecommendedActions; +import com.azure.resourcemanager.resourcehealth.models.EventSourceValues; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.EventTypeValues; +import com.azure.resourcemanager.resourcehealth.models.Faq; +import com.azure.resourcemanager.resourcehealth.models.Impact; +import com.azure.resourcemanager.resourcehealth.models.LevelValues; +import com.azure.resourcemanager.resourcehealth.models.Link; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of event. */ +@Fluent +public final class EventProperties { + /* + * Type of event. + */ + @JsonProperty(value = "eventType") + private EventTypeValues eventType; + + /* + * Source of event. + */ + @JsonProperty(value = "eventSource") + private EventSourceValues eventSource; + + /* + * Current status of event. + */ + @JsonProperty(value = "status") + private EventStatusValues status; + + /* + * Title text of event. + */ + @JsonProperty(value = "title") + private String title; + + /* + * Summary text of event. + */ + @JsonProperty(value = "summary") + private String summary; + + /* + * Header text of event. + */ + @JsonProperty(value = "header") + private String headerProperty; + + /* + * Level of insight. + */ + @JsonProperty(value = "level") + private LevelValues level; + + /* + * Level of event. + */ + @JsonProperty(value = "eventLevel") + private EventLevelValues eventLevel; + + /* + * The id of the Incident + */ + @JsonProperty(value = "externalIncidentId") + private String externalIncidentId; + + /* + * Article of event. + */ + @JsonProperty(value = "article") + private EventPropertiesArticle article; + + /* + * Useful links of event. + */ + @JsonProperty(value = "links") + private List links; + + /* + * It provides the Timestamp for when the health impacting event started. + */ + @JsonProperty(value = "impactStartTime") + private OffsetDateTime impactStartTime; + + /* + * It provides the Timestamp for when the health impacting event resolved. + */ + @JsonProperty(value = "impactMitigationTime") + private OffsetDateTime impactMitigationTime; + + /* + * List services impacted by the service health event. + */ + @JsonProperty(value = "impact") + private List impact; + + /* + * Recommended actions of event. + */ + @JsonProperty(value = "recommendedActions") + private EventPropertiesRecommendedActions recommendedActions; + + /* + * Frequently asked questions for the service health event. + */ + @JsonProperty(value = "faqs") + private List faqs; + + /* + * It provides information if the event is High incident rate event or not. + */ + @JsonProperty(value = "isHIR") + private Boolean isHir; + + /* + * Tells if we want to enable or disable Microsoft Support for this event. + */ + @JsonProperty(value = "enableMicrosoftSupport") + private Boolean enableMicrosoftSupport; + + /* + * Contains the communication message for the event, that could include summary, root cause and other details. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Is true if the event is platform initiated. + */ + @JsonProperty(value = "platformInitiated") + private Boolean platformInitiated; + + /* + * Tells if we want to enable or disable Microsoft Support for this event. + */ + @JsonProperty(value = "enableChatWithUs") + private Boolean enableChatWithUs; + + /* + * Priority level of the event. Has value from 0 to 23. 0 is the highest priority. Service issue events have higher + * priority followed by planned maintenance and health advisory. Critical events have higher priority followed by + * error, warning and informational. Furthermore, active events have higher priority than resolved. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /* + * It provides the Timestamp for when the health impacting event was last updated. + */ + @JsonProperty(value = "lastUpdateTime") + private OffsetDateTime lastUpdateTime; + + /* + * Stage for HIR Document + */ + @JsonProperty(value = "hirStage") + private String hirStage; + + /* + * Additional information + */ + @JsonProperty(value = "additionalInformation") + private EventPropertiesAdditionalInformation additionalInformation; + + /* + * duration in seconds + */ + @JsonProperty(value = "duration") + private Integer duration; + + /* + * The type of the impact + */ + @JsonProperty(value = "impactType") + private String impactType; + + /** Creates an instance of EventProperties class. */ + public EventProperties() { + } + + /** + * Get the eventType property: Type of event. + * + * @return the eventType value. + */ + public EventTypeValues eventType() { + return this.eventType; + } + + /** + * Set the eventType property: Type of event. + * + * @param eventType the eventType value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEventType(EventTypeValues eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get the eventSource property: Source of event. + * + * @return the eventSource value. + */ + public EventSourceValues eventSource() { + return this.eventSource; + } + + /** + * Set the eventSource property: Source of event. + * + * @param eventSource the eventSource value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEventSource(EventSourceValues eventSource) { + this.eventSource = eventSource; + return this; + } + + /** + * Get the status property: Current status of event. + * + * @return the status value. + */ + public EventStatusValues status() { + return this.status; + } + + /** + * Set the status property: Current status of event. + * + * @param status the status value to set. + * @return the EventProperties object itself. + */ + public EventProperties withStatus(EventStatusValues status) { + this.status = status; + return this; + } + + /** + * Get the title property: Title text of event. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Title text of event. + * + * @param title the title value to set. + * @return the EventProperties object itself. + */ + public EventProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the summary property: Summary text of event. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Set the summary property: Summary text of event. + * + * @param summary the summary value to set. + * @return the EventProperties object itself. + */ + public EventProperties withSummary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get the headerProperty property: Header text of event. + * + * @return the headerProperty value. + */ + public String headerProperty() { + return this.headerProperty; + } + + /** + * Set the headerProperty property: Header text of event. + * + * @param headerProperty the headerProperty value to set. + * @return the EventProperties object itself. + */ + public EventProperties withHeaderProperty(String headerProperty) { + this.headerProperty = headerProperty; + return this; + } + + /** + * Get the level property: Level of insight. + * + * @return the level value. + */ + public LevelValues level() { + return this.level; + } + + /** + * Set the level property: Level of insight. + * + * @param level the level value to set. + * @return the EventProperties object itself. + */ + public EventProperties withLevel(LevelValues level) { + this.level = level; + return this; + } + + /** + * Get the eventLevel property: Level of event. + * + * @return the eventLevel value. + */ + public EventLevelValues eventLevel() { + return this.eventLevel; + } + + /** + * Set the eventLevel property: Level of event. + * + * @param eventLevel the eventLevel value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEventLevel(EventLevelValues eventLevel) { + this.eventLevel = eventLevel; + return this; + } + + /** + * Get the externalIncidentId property: The id of the Incident. + * + * @return the externalIncidentId value. + */ + public String externalIncidentId() { + return this.externalIncidentId; + } + + /** + * Set the externalIncidentId property: The id of the Incident. + * + * @param externalIncidentId the externalIncidentId value to set. + * @return the EventProperties object itself. + */ + public EventProperties withExternalIncidentId(String externalIncidentId) { + this.externalIncidentId = externalIncidentId; + return this; + } + + /** + * Get the article property: Article of event. + * + * @return the article value. + */ + public EventPropertiesArticle article() { + return this.article; + } + + /** + * Set the article property: Article of event. + * + * @param article the article value to set. + * @return the EventProperties object itself. + */ + public EventProperties withArticle(EventPropertiesArticle article) { + this.article = article; + return this; + } + + /** + * Get the links property: Useful links of event. + * + * @return the links value. + */ + public List links() { + return this.links; + } + + /** + * Set the links property: Useful links of event. + * + * @param links the links value to set. + * @return the EventProperties object itself. + */ + public EventProperties withLinks(List links) { + this.links = links; + return this; + } + + /** + * Get the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @return the impactStartTime value. + */ + public OffsetDateTime impactStartTime() { + return this.impactStartTime; + } + + /** + * Set the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @param impactStartTime the impactStartTime value to set. + * @return the EventProperties object itself. + */ + public EventProperties withImpactStartTime(OffsetDateTime impactStartTime) { + this.impactStartTime = impactStartTime; + return this; + } + + /** + * Get the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @return the impactMitigationTime value. + */ + public OffsetDateTime impactMitigationTime() { + return this.impactMitigationTime; + } + + /** + * Set the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @param impactMitigationTime the impactMitigationTime value to set. + * @return the EventProperties object itself. + */ + public EventProperties withImpactMitigationTime(OffsetDateTime impactMitigationTime) { + this.impactMitigationTime = impactMitigationTime; + return this; + } + + /** + * Get the impact property: List services impacted by the service health event. + * + * @return the impact value. + */ + public List impact() { + return this.impact; + } + + /** + * Set the impact property: List services impacted by the service health event. + * + * @param impact the impact value to set. + * @return the EventProperties object itself. + */ + public EventProperties withImpact(List impact) { + this.impact = impact; + return this; + } + + /** + * Get the recommendedActions property: Recommended actions of event. + * + * @return the recommendedActions value. + */ + public EventPropertiesRecommendedActions recommendedActions() { + return this.recommendedActions; + } + + /** + * Set the recommendedActions property: Recommended actions of event. + * + * @param recommendedActions the recommendedActions value to set. + * @return the EventProperties object itself. + */ + public EventProperties withRecommendedActions(EventPropertiesRecommendedActions recommendedActions) { + this.recommendedActions = recommendedActions; + return this; + } + + /** + * Get the faqs property: Frequently asked questions for the service health event. + * + * @return the faqs value. + */ + public List faqs() { + return this.faqs; + } + + /** + * Set the faqs property: Frequently asked questions for the service health event. + * + * @param faqs the faqs value to set. + * @return the EventProperties object itself. + */ + public EventProperties withFaqs(List faqs) { + this.faqs = faqs; + return this; + } + + /** + * Get the isHir property: It provides information if the event is High incident rate event or not. + * + * @return the isHir value. + */ + public Boolean isHir() { + return this.isHir; + } + + /** + * Set the isHir property: It provides information if the event is High incident rate event or not. + * + * @param isHir the isHir value to set. + * @return the EventProperties object itself. + */ + public EventProperties withIsHir(Boolean isHir) { + this.isHir = isHir; + return this; + } + + /** + * Get the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableMicrosoftSupport value. + */ + public Boolean enableMicrosoftSupport() { + return this.enableMicrosoftSupport; + } + + /** + * Set the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @param enableMicrosoftSupport the enableMicrosoftSupport value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEnableMicrosoftSupport(Boolean enableMicrosoftSupport) { + this.enableMicrosoftSupport = enableMicrosoftSupport; + return this; + } + + /** + * Get the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @param description the description value to set. + * @return the EventProperties object itself. + */ + public EventProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the platformInitiated property: Is true if the event is platform initiated. + * + * @return the platformInitiated value. + */ + public Boolean platformInitiated() { + return this.platformInitiated; + } + + /** + * Set the platformInitiated property: Is true if the event is platform initiated. + * + * @param platformInitiated the platformInitiated value to set. + * @return the EventProperties object itself. + */ + public EventProperties withPlatformInitiated(Boolean platformInitiated) { + this.platformInitiated = platformInitiated; + return this; + } + + /** + * Get the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableChatWithUs value. + */ + public Boolean enableChatWithUs() { + return this.enableChatWithUs; + } + + /** + * Set the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @param enableChatWithUs the enableChatWithUs value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEnableChatWithUs(Boolean enableChatWithUs) { + this.enableChatWithUs = enableChatWithUs; + return this; + } + + /** + * Get the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @return the priority value. + */ + public Integer priority() { + return this.priority; + } + + /** + * Set the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @param priority the priority value to set. + * @return the EventProperties object itself. + */ + public EventProperties withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @param lastUpdateTime the lastUpdateTime value to set. + * @return the EventProperties object itself. + */ + public EventProperties withLastUpdateTime(OffsetDateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the hirStage property: Stage for HIR Document. + * + * @return the hirStage value. + */ + public String hirStage() { + return this.hirStage; + } + + /** + * Set the hirStage property: Stage for HIR Document. + * + * @param hirStage the hirStage value to set. + * @return the EventProperties object itself. + */ + public EventProperties withHirStage(String hirStage) { + this.hirStage = hirStage; + return this; + } + + /** + * Get the additionalInformation property: Additional information. + * + * @return the additionalInformation value. + */ + public EventPropertiesAdditionalInformation additionalInformation() { + return this.additionalInformation; + } + + /** + * Set the additionalInformation property: Additional information. + * + * @param additionalInformation the additionalInformation value to set. + * @return the EventProperties object itself. + */ + public EventProperties withAdditionalInformation(EventPropertiesAdditionalInformation additionalInformation) { + this.additionalInformation = additionalInformation; + return this; + } + + /** + * Get the duration property: duration in seconds. + * + * @return the duration value. + */ + public Integer duration() { + return this.duration; + } + + /** + * Set the duration property: duration in seconds. + * + * @param duration the duration value to set. + * @return the EventProperties object itself. + */ + public EventProperties withDuration(Integer duration) { + this.duration = duration; + return this; + } + + /** + * Get the impactType property: The type of the impact. + * + * @return the impactType value. + */ + public String impactType() { + return this.impactType; + } + + /** + * Set the impactType property: The type of the impact. + * + * @param impactType the impactType value to set. + * @return the EventProperties object itself. + */ + public EventProperties withImpactType(String impactType) { + this.impactType = impactType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (article() != null) { + article().validate(); + } + if (links() != null) { + links().forEach(e -> e.validate()); + } + if (impact() != null) { + impact().forEach(e -> e.validate()); + } + if (recommendedActions() != null) { + recommendedActions().validate(); + } + if (faqs() != null) { + faqs().forEach(e -> e.validate()); + } + if (additionalInformation() != null) { + additionalInformation().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/OperationListResultInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/OperationListResultInner.java index 0d803918dc0e..2c78b0dd5792 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/OperationListResultInner.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/OperationListResultInner.java @@ -19,6 +19,10 @@ public final class OperationListResultInner { @JsonProperty(value = "value", required = true) private List value; + /** Creates an instance of OperationListResultInner class. */ + public OperationListResultInner() { + } + /** * Get the value property: List of operations available in the resourcehealth resource provider. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/AvailabilityStatusesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/AvailabilityStatusesClientImpl.java index 3a9fa218ab9c..c38c1031fd67 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/AvailabilityStatusesClientImpl.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/AvailabilityStatusesClientImpl.java @@ -56,7 +56,7 @@ public final class AvailabilityStatusesClientImpl implements AvailabilityStatuse */ @Host("{$host}") @ServiceInterface(name = "MicrosoftResourceHea") - private interface AvailabilityStatusesService { + public interface AvailabilityStatusesService { @Headers({"Content-Type: application/json"}) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses") @ExpectedResponses({200}) @@ -628,25 +628,17 @@ private Mono> getByResourceWithResponseAsync( * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} * and * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - * @param filter The filter to apply on the operation. For more information please see - * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return current availability status for a single resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceAsync(String resourceUri, String filter, String expand) { + private Mono getByResourceAsync(String resourceUri) { + final String filter = null; + final String expand = null; return getByResourceWithResponseAsync(resourceUri, filter, expand) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -657,24 +649,19 @@ private Mono getByResourceAsync(String resourceUri, Str * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} * and * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return current availability status for a single resource on successful completion of {@link Mono}. + * @return current availability status for a single resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceAsync(String resourceUri) { - final String filter = null; - final String expand = null; - return getByResourceWithResponseAsync(resourceUri, filter, expand) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + public Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context) { + return getByResourceWithResponseAsync(resourceUri, filter, expand, context).block(); } /** @@ -694,30 +681,7 @@ private Mono getByResourceAsync(String resourceUri) { public AvailabilityStatusInner getByResource(String resourceUri) { final String filter = null; final String expand = null; - return getByResourceAsync(resourceUri, filter, expand).block(); - } - - /** - * Gets current availability status for a single resource. - * - * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. - * Currently the API support not nested and one nesting level resource types : - * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - * and - * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - * @param filter The filter to apply on the operation. For more information please see - * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return current availability status for a single resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceWithResponse( - String resourceUri, String filter, String expand, Context context) { - return getByResourceWithResponseAsync(resourceUri, filter, expand, context).block(); + return getByResourceWithResponse(resourceUri, filter, expand, Context.NONE).getValue(); } /** @@ -933,7 +897,8 @@ public PagedIterable list( /** * Get the next page of items. * - * @param nextLink The nextLink parameter. + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -970,7 +935,8 @@ private Mono> listBySubscriptionIdNextSin /** * Get the next page of items. * - * @param nextLink The nextLink parameter. + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1008,7 +974,8 @@ private Mono> listBySubscriptionIdNextSin /** * Get the next page of items. * - * @param nextLink The nextLink parameter. + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1045,7 +1012,8 @@ private Mono> listByResourceGroupNextSing /** * Get the next page of items. * - * @param nextLink The nextLink parameter. + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1083,7 +1051,8 @@ private Mono> listByResourceGroupNextSing /** * Get the next page of items. * - * @param nextLink The nextLink parameter. + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1119,7 +1088,8 @@ private Mono> listNextSinglePageAsync(Str /** * Get the next page of items. * - * @param nextLink The nextLink parameter. + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/AvailabilityStatusesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/AvailabilityStatusesImpl.java index 0bba94049df7..d6181cd4f714 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/AvailabilityStatusesImpl.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/AvailabilityStatusesImpl.java @@ -51,15 +51,6 @@ public PagedIterable listByResourceGroup( return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); } - public AvailabilityStatus getByResource(String resourceUri) { - AvailabilityStatusInner inner = this.serviceClient().getByResource(resourceUri); - if (inner != null) { - return new AvailabilityStatusImpl(inner, this.manager()); - } else { - return null; - } - } - public Response getByResourceWithResponse( String resourceUri, String filter, String expand, Context context) { Response inner = @@ -75,6 +66,15 @@ public Response getByResourceWithResponse( } } + public AvailabilityStatus getByResource(String resourceUri) { + AvailabilityStatusInner inner = this.serviceClient().getByResource(resourceUri); + if (inner != null) { + return new AvailabilityStatusImpl(inner, this.manager()); + } else { + return null; + } + } + public PagedIterable list(String resourceUri) { PagedIterable inner = this.serviceClient().list(resourceUri); return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpactedResourceImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpactedResourceImpl.java new file mode 100644 index 000000000000..86d7682e0ea2 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpactedResourceImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import com.azure.resourcemanager.resourcehealth.models.KeyValueItem; +import java.util.Collections; +import java.util.List; + +public final class EventImpactedResourceImpl implements EventImpactedResource { + private EventImpactedResourceInner innerObject; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + EventImpactedResourceImpl( + EventImpactedResourceInner innerObject, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String targetResourceType() { + return this.innerModel().targetResourceType(); + } + + public String targetResourceId() { + return this.innerModel().targetResourceId(); + } + + public String targetRegion() { + return this.innerModel().targetRegion(); + } + + public List info() { + List inner = this.innerModel().info(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EventImpactedResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpl.java new file mode 100644 index 000000000000..c0ed0b5fac7e --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.Event; +import com.azure.resourcemanager.resourcehealth.models.EventLevelValues; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesAdditionalInformation; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesArticle; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesRecommendedActions; +import com.azure.resourcemanager.resourcehealth.models.EventSourceValues; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.EventTypeValues; +import com.azure.resourcemanager.resourcehealth.models.Faq; +import com.azure.resourcemanager.resourcehealth.models.Impact; +import com.azure.resourcemanager.resourcehealth.models.LevelValues; +import com.azure.resourcemanager.resourcehealth.models.Link; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class EventImpl implements Event { + private EventInner innerObject; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + EventImpl(EventInner innerObject, com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public EventTypeValues eventType() { + return this.innerModel().eventType(); + } + + public EventSourceValues eventSource() { + return this.innerModel().eventSource(); + } + + public EventStatusValues status() { + return this.innerModel().status(); + } + + public String title() { + return this.innerModel().title(); + } + + public String summary() { + return this.innerModel().summary(); + } + + public String headerProperty() { + return this.innerModel().headerProperty(); + } + + public LevelValues level() { + return this.innerModel().level(); + } + + public EventLevelValues eventLevel() { + return this.innerModel().eventLevel(); + } + + public String externalIncidentId() { + return this.innerModel().externalIncidentId(); + } + + public EventPropertiesArticle article() { + return this.innerModel().article(); + } + + public List links() { + List inner = this.innerModel().links(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime impactStartTime() { + return this.innerModel().impactStartTime(); + } + + public OffsetDateTime impactMitigationTime() { + return this.innerModel().impactMitigationTime(); + } + + public List impact() { + List inner = this.innerModel().impact(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EventPropertiesRecommendedActions recommendedActions() { + return this.innerModel().recommendedActions(); + } + + public List faqs() { + List inner = this.innerModel().faqs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean isHir() { + return this.innerModel().isHir(); + } + + public Boolean enableMicrosoftSupport() { + return this.innerModel().enableMicrosoftSupport(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean platformInitiated() { + return this.innerModel().platformInitiated(); + } + + public Boolean enableChatWithUs() { + return this.innerModel().enableChatWithUs(); + } + + public Integer priority() { + return this.innerModel().priority(); + } + + public OffsetDateTime lastUpdateTime() { + return this.innerModel().lastUpdateTime(); + } + + public String hirStage() { + return this.innerModel().hirStage(); + } + + public EventPropertiesAdditionalInformation additionalInformation() { + return this.innerModel().additionalInformation(); + } + + public Integer duration() { + return this.innerModel().duration(); + } + + public String impactType() { + return this.innerModel().impactType(); + } + + public EventInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsClientImpl.java new file mode 100644 index 000000000000..d6346c011120 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsClientImpl.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.resourcehealth.fluent.EventOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EventOperationsClient. */ +public final class EventOperationsClientImpl implements EventOperationsClient { + /** The proxy service used to perform REST calls. */ + private final EventOperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of EventOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EventOperationsClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(EventOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthEventOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface EventOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getBySubscriptionIdAndTrackingId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("queryStartTime") String queryStartTime, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("eventTrackingId") String eventTrackingId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByTenantIdAndTrackingId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("queryStartTime") String queryStartTime, + @PathParam("eventTrackingId") String eventTrackingId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBySubscriptionIdAndTrackingIdWithResponseAsync( + String eventTrackingId, String filter, String queryStartTime) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getBySubscriptionIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + this.client.getSubscriptionId(), + eventTrackingId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBySubscriptionIdAndTrackingIdWithResponseAsync( + String eventTrackingId, String filter, String queryStartTime, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getBySubscriptionIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + this.client.getSubscriptionId(), + eventTrackingId, + accept, + context); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getBySubscriptionIdAndTrackingIdAsync(String eventTrackingId) { + final String filter = null; + final String queryStartTime = null; + return getBySubscriptionIdAndTrackingIdWithResponseAsync(eventTrackingId, filter, queryStartTime) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context) { + return getBySubscriptionIdAndTrackingIdWithResponseAsync(eventTrackingId, filter, queryStartTime, context) + .block(); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventInner getBySubscriptionIdAndTrackingId(String eventTrackingId) { + final String filter = null; + final String queryStartTime = null; + return getBySubscriptionIdAndTrackingIdWithResponse(eventTrackingId, filter, queryStartTime, Context.NONE) + .getValue(); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByTenantIdAndTrackingIdWithResponseAsync( + String eventTrackingId, String filter, String queryStartTime) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByTenantIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + eventTrackingId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByTenantIdAndTrackingIdWithResponseAsync( + String eventTrackingId, String filter, String queryStartTime, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByTenantIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + eventTrackingId, + accept, + context); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByTenantIdAndTrackingIdAsync(String eventTrackingId) { + final String filter = null; + final String queryStartTime = null; + return getByTenantIdAndTrackingIdWithResponseAsync(eventTrackingId, filter, queryStartTime) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context) { + return getByTenantIdAndTrackingIdWithResponseAsync(eventTrackingId, filter, queryStartTime, context).block(); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventInner getByTenantIdAndTrackingId(String eventTrackingId) { + final String filter = null; + final String queryStartTime = null; + return getByTenantIdAndTrackingIdWithResponse(eventTrackingId, filter, queryStartTime, Context.NONE).getValue(); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsImpl.java new file mode 100644 index 000000000000..afe1ef2257fb --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.EventOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.Event; +import com.azure.resourcemanager.resourcehealth.models.EventOperations; + +public final class EventOperationsImpl implements EventOperations { + private static final ClientLogger LOGGER = new ClientLogger(EventOperationsImpl.class); + + private final EventOperationsClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public EventOperationsImpl( + EventOperationsClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context) { + Response inner = + this + .serviceClient() + .getBySubscriptionIdAndTrackingIdWithResponse(eventTrackingId, filter, queryStartTime, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Event getBySubscriptionIdAndTrackingId(String eventTrackingId) { + EventInner inner = this.serviceClient().getBySubscriptionIdAndTrackingId(eventTrackingId); + if (inner != null) { + return new EventImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context) { + Response inner = + this + .serviceClient() + .getByTenantIdAndTrackingIdWithResponse(eventTrackingId, filter, queryStartTime, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Event getByTenantIdAndTrackingId(String eventTrackingId) { + EventInner inner = this.serviceClient().getByTenantIdAndTrackingId(eventTrackingId); + if (inner != null) { + return new EventImpl(inner, this.manager()); + } else { + return null; + } + } + + private EventOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsClientImpl.java new file mode 100644 index 000000000000..8f5557f58bfa --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsClientImpl.java @@ -0,0 +1,915 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.resourcehealth.fluent.EventsOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.Events; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EventsOperationsClient. */ +public final class EventsOperationsClientImpl implements EventsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final EventsOperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of EventsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EventsOperationsClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(EventsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthEventsOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface EventsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("queryStartTime") String queryStartTime, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/events") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("queryStartTime") String queryStartTime, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ResourceHealth/events") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySingleResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySingleResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String queryStartTime) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String queryStartTime, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String queryStartTime) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, queryStartTime), + nextLink -> listBySubscriptionIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists service health events in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final String queryStartTime = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter, queryStartTime), + nextLink -> listBySubscriptionIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String queryStartTime, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, queryStartTime, context), + nextLink -> listBySubscriptionIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists service health events in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final String queryStartTime = null; + return new PagedIterable<>(listAsync(filter, queryStartTime)); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, String queryStartTime, Context context) { + return new PagedIterable<>(listAsync(filter, queryStartTime, context)); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdSinglePageAsync(String filter, String queryStartTime) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByTenantId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdSinglePageAsync( + String filter, String queryStartTime, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTenantId( + this.client.getEndpoint(), this.client.getApiVersion(), filter, queryStartTime, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAsync(String filter, String queryStartTime) { + return new PagedFlux<>( + () -> listByTenantIdSinglePageAsync(filter, queryStartTime), + nextLink -> listByTenantIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists current service health events in the tenant. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAsync() { + final String filter = null; + final String queryStartTime = null; + return new PagedFlux<>( + () -> listByTenantIdSinglePageAsync(filter, queryStartTime), + nextLink -> listByTenantIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAsync(String filter, String queryStartTime, Context context) { + return new PagedFlux<>( + () -> listByTenantIdSinglePageAsync(filter, queryStartTime, context), + nextLink -> listByTenantIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists current service health events in the tenant. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenantId() { + final String filter = null; + final String queryStartTime = null; + return new PagedIterable<>(listByTenantIdAsync(filter, queryStartTime)); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenantId(String filter, String queryStartTime, Context context) { + return new PagedIterable<>(listByTenantIdAsync(filter, queryStartTime, context)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySingleResourceSinglePageAsync(String resourceUri, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySingleResource( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySingleResourceSinglePageAsync( + String resourceUri, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySingleResource( + this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySingleResourceAsync(String resourceUri, String filter) { + return new PagedFlux<>( + () -> listBySingleResourceSinglePageAsync(resourceUri, filter), + nextLink -> listBySingleResourceNextSinglePageAsync(nextLink)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySingleResourceAsync(String resourceUri) { + final String filter = null; + return new PagedFlux<>( + () -> listBySingleResourceSinglePageAsync(resourceUri, filter), + nextLink -> listBySingleResourceNextSinglePageAsync(nextLink)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySingleResourceAsync(String resourceUri, String filter, Context context) { + return new PagedFlux<>( + () -> listBySingleResourceSinglePageAsync(resourceUri, filter, context), + nextLink -> listBySingleResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySingleResource(String resourceUri) { + final String filter = null; + return new PagedIterable<>(listBySingleResourceAsync(resourceUri, filter)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySingleResource(String resourceUri, String filter, Context context) { + return new PagedIterable<>(listBySingleResourceAsync(resourceUri, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionIdNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByTenantIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTenantIdNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySingleResourceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySingleResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySingleResourceNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySingleResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsImpl.java new file mode 100644 index 000000000000..92e0ba02b5e2 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.EventsOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.Event; +import com.azure.resourcemanager.resourcehealth.models.EventsOperations; + +public final class EventsOperationsImpl implements EventsOperations { + private static final ClientLogger LOGGER = new ClientLogger(EventsOperationsImpl.class); + + private final EventsOperationsClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public EventsOperationsImpl( + EventsOperationsClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, String queryStartTime, Context context) { + PagedIterable inner = this.serviceClient().list(filter, queryStartTime, context); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantId() { + PagedIterable inner = this.serviceClient().listByTenantId(); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantId(String filter, String queryStartTime, Context context) { + PagedIterable inner = this.serviceClient().listByTenantId(filter, queryStartTime, context); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable listBySingleResource(String resourceUri) { + PagedIterable inner = this.serviceClient().listBySingleResource(resourceUri); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable listBySingleResource(String resourceUri, String filter, Context context) { + PagedIterable inner = this.serviceClient().listBySingleResource(resourceUri, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + private EventsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesClientImpl.java new file mode 100644 index 000000000000..0e0b61b601e4 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesClientImpl.java @@ -0,0 +1,523 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.resourcehealth.fluent.ImpactedResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ImpactedResourcesClient. */ +public final class ImpactedResourcesClientImpl implements ImpactedResourcesClient { + /** The proxy service used to perform REST calls. */ + private final ImpactedResourcesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of ImpactedResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImpactedResourcesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(ImpactedResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthImpactedResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface ImpactedResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" + + "/impactedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdAndEventId( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("eventTrackingId") String eventTrackingId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" + + "/impactedResources/{impactedResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("eventTrackingId") String eventTrackingId, + @PathParam("impactedResourceName") String impactedResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdAndEventIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscriptionIdAndEventId( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionIdAndEventId( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync( + String eventTrackingId, String filter) { + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync(String eventTrackingId) { + final String filter = null; + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync( + String eventTrackingId, String filter, Context context) { + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter, context), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId) { + final String filter = null; + return new PagedIterable<>(listBySubscriptionIdAndEventIdAsync(eventTrackingId, filter)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context) { + return new PagedIterable<>(listBySubscriptionIdAndEventIdAsync(eventTrackingId, filter, context)); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String eventTrackingId, String impactedResourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + if (impactedResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter impactedResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + impactedResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String eventTrackingId, String impactedResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + if (impactedResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter impactedResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + impactedResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String eventTrackingId, String impactedResourceName) { + return getWithResponseAsync(eventTrackingId, impactedResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String eventTrackingId, String impactedResourceName, Context context) { + return getWithResponseAsync(eventTrackingId, impactedResourceName, context).block(); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventImpactedResourceInner get(String eventTrackingId, String impactedResourceName) { + return getWithResponse(eventTrackingId, impactedResourceName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listBySubscriptionIdAndEventIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionIdAndEventIdNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesImpl.java new file mode 100644 index 000000000000..ab90c186cc3b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.ImpactedResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import com.azure.resourcemanager.resourcehealth.models.ImpactedResources; + +public final class ImpactedResourcesImpl implements ImpactedResources { + private static final ClientLogger LOGGER = new ClientLogger(ImpactedResourcesImpl.class); + + private final ImpactedResourcesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public ImpactedResourcesImpl( + ImpactedResourcesClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId) { + PagedIterable inner = + this.serviceClient().listBySubscriptionIdAndEventId(eventTrackingId); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listBySubscriptionIdAndEventId(eventTrackingId, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String eventTrackingId, String impactedResourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(eventTrackingId, impactedResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpactedResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EventImpactedResource get(String eventTrackingId, String impactedResourceName) { + EventImpactedResourceInner inner = this.serviceClient().get(eventTrackingId, impactedResourceName); + if (inner != null) { + return new EventImpactedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private ImpactedResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MicrosoftResourceHealthBuilder.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MicrosoftResourceHealthBuilder.java index d08a0643b657..07a1e0d60e7e 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MicrosoftResourceHealthBuilder.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MicrosoftResourceHealthBuilder.java @@ -7,7 +7,6 @@ import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.AzureEnvironment; @@ -19,15 +18,12 @@ @ServiceClientBuilder(serviceClients = {MicrosoftResourceHealthImpl.class}) public final class MicrosoftResourceHealthBuilder { /* - * Subscription credentials which uniquely identify Microsoft Azure - * subscription. The subscription ID forms part of the URI for every - * service call. + * The ID of the target subscription. */ private String subscriptionId; /** - * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. + * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the MicrosoftResourceHealthBuilder. @@ -70,34 +66,34 @@ public MicrosoftResourceHealthBuilder environment(AzureEnvironment environment) } /* - * The default poll interval for long-running operation + * The HTTP pipeline to send requests through */ - private Duration defaultPollInterval; + private HttpPipeline pipeline; /** - * Sets The default poll interval for long-running operation. + * Sets The HTTP pipeline to send requests through. * - * @param defaultPollInterval the defaultPollInterval value. + * @param pipeline the pipeline value. * @return the MicrosoftResourceHealthBuilder. */ - public MicrosoftResourceHealthBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; + public MicrosoftResourceHealthBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; return this; } /* - * The HTTP pipeline to send requests through + * The default poll interval for long-running operation */ - private HttpPipeline pipeline; + private Duration defaultPollInterval; /** - * Sets The HTTP pipeline to send requests through. + * Sets The default poll interval for long-running operation. * - * @param pipeline the pipeline value. + * @param defaultPollInterval the defaultPollInterval value. * @return the MicrosoftResourceHealthBuilder. */ - public MicrosoftResourceHealthBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + public MicrosoftResourceHealthBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; return this; } @@ -123,27 +119,26 @@ public MicrosoftResourceHealthBuilder serializerAdapter(SerializerAdapter serial * @return an instance of MicrosoftResourceHealthImpl. */ public MicrosoftResourceHealthImpl buildClient() { - if (endpoint == null) { - this.endpoint = "https://management.azure.com"; - } - if (environment == null) { - this.environment = AzureEnvironment.AZURE; - } - if (defaultPollInterval == null) { - this.defaultPollInterval = Duration.ofSeconds(30); - } - if (pipeline == null) { - this.pipeline = - new HttpPipelineBuilder() - .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) - .build(); - } - if (serializerAdapter == null) { - this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); - } + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); MicrosoftResourceHealthImpl client = new MicrosoftResourceHealthImpl( - pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); return client; } } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MicrosoftResourceHealthImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MicrosoftResourceHealthImpl.java index 136d1586af53..73ed85d486a6 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MicrosoftResourceHealthImpl.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MicrosoftResourceHealthImpl.java @@ -15,6 +15,7 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -22,6 +23,9 @@ import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.resourcehealth.fluent.AvailabilityStatusesClient; +import com.azure.resourcemanager.resourcehealth.fluent.EventOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.EventsOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.ImpactedResourcesClient; import com.azure.resourcemanager.resourcehealth.fluent.MicrosoftResourceHealth; import com.azure.resourcemanager.resourcehealth.fluent.OperationsClient; import java.io.IOException; @@ -30,22 +34,17 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.time.Duration; -import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** Initializes a new instance of the MicrosoftResourceHealthImpl type. */ @ServiceClient(builder = MicrosoftResourceHealthBuilder.class) public final class MicrosoftResourceHealthImpl implements MicrosoftResourceHealth { - /** - * Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of - * the URI for every service call. - */ + /** The ID of the target subscription. */ private final String subscriptionId; /** - * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. + * Gets The ID of the target subscription. * * @return the subscriptionId value. */ @@ -137,6 +136,42 @@ public OperationsClient getOperations() { return this.operations; } + /** The ImpactedResourcesClient object to access its operations. */ + private final ImpactedResourcesClient impactedResources; + + /** + * Gets the ImpactedResourcesClient object to access its operations. + * + * @return the ImpactedResourcesClient object. + */ + public ImpactedResourcesClient getImpactedResources() { + return this.impactedResources; + } + + /** The EventsOperationsClient object to access its operations. */ + private final EventsOperationsClient eventsOperations; + + /** + * Gets the EventsOperationsClient object to access its operations. + * + * @return the EventsOperationsClient object. + */ + public EventsOperationsClient getEventsOperations() { + return this.eventsOperations; + } + + /** The EventOperationsClient object to access its operations. */ + private final EventOperationsClient eventOperations; + + /** + * Gets the EventOperationsClient object to access its operations. + * + * @return the EventOperationsClient object. + */ + public EventOperationsClient getEventOperations() { + return this.eventOperations; + } + /** * Initializes an instance of MicrosoftResourceHealth client. * @@ -144,8 +179,7 @@ public OperationsClient getOperations() { * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure subscription. The - * subscription ID forms part of the URI for every service call. + * @param subscriptionId The ID of the target subscription. * @param endpoint server parameter. */ MicrosoftResourceHealthImpl( @@ -160,9 +194,12 @@ public OperationsClient getOperations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2020-05-01"; + this.apiVersion = "2022-10-01-preview"; this.availabilityStatuses = new AvailabilityStatusesClientImpl(this); this.operations = new OperationsClientImpl(this); + this.impactedResources = new ImpactedResourcesClientImpl(this); + this.eventsOperations = new EventsOperationsClientImpl(this); + this.eventOperations = new EventOperationsClientImpl(this); } /** @@ -181,10 +218,7 @@ public Context getContext() { * @return the merged context. */ public Context mergeContext(Context context) { - for (Map.Entry entry : this.getContext().getValues().entrySet()) { - context = context.addData(entry.getKey(), entry.getValue()); - } - return context; + return CoreUtils.mergeContexts(this.getContext(), context); } /** diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/OperationsClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/OperationsClientImpl.java index 516f17ca3bb2..b02d2f6e6b62 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/OperationsClientImpl.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/OperationsClientImpl.java @@ -49,7 +49,7 @@ public final class OperationsClientImpl implements OperationsClient { */ @Host("{$host}") @ServiceInterface(name = "MicrosoftResourceHea") - private interface OperationsService { + public interface OperationsService { @Headers({"Content-Type: application/json"}) @Get("/providers/Microsoft.ResourceHealth/operations") @ExpectedResponses({200}) @@ -114,40 +114,32 @@ private Mono> listWithResponseAsync(Context c */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono listAsync() { - return listWithResponseAsync() - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Lists available operations for the resourcehealth resource provider. * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return lists the operations response. + * @return lists the operations response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public OperationListResultInner list() { - return listAsync().block(); + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); } /** * Lists available operations for the resourcehealth resource provider. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return lists the operations response along with {@link Response}. + * @return lists the operations response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(Context context) { - return listWithResponseAsync(context).block(); + public OperationListResultInner list() { + return listWithResponse(Context.NONE).getValue(); } } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/OperationsImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/OperationsImpl.java index 7e5467d8790b..1a7db9b8955f 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/OperationsImpl.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/OperationsImpl.java @@ -26,15 +26,6 @@ public OperationsImpl( this.serviceManager = serviceManager; } - public OperationListResult list() { - OperationListResultInner inner = this.serviceClient().list(); - if (inner != null) { - return new OperationListResultImpl(inner, this.manager()); - } else { - return null; - } - } - public Response listWithResponse(Context context) { Response inner = this.serviceClient().listWithResponse(context); if (inner != null) { @@ -48,6 +39,15 @@ public Response listWithResponse(Context context) { } } + public OperationListResult list() { + OperationListResultInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + private OperationsClient serviceClient() { return this.innerClient; } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStateValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStateValues.java index e1f35fdb3978..b0d85a46fadb 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStateValues.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStateValues.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for AvailabilityStateValues. */ +/** Impacted resource status of the resource. */ public final class AvailabilityStateValues extends ExpandableStringEnum { /** Static value Available for AvailabilityStateValues. */ public static final AvailabilityStateValues AVAILABLE = fromString("Available"); @@ -33,7 +33,11 @@ public static AvailabilityStateValues fromString(String name) { return fromString(name, AvailabilityStateValues.class); } - /** @return known AvailabilityStateValues values. */ + /** + * Gets known AvailabilityStateValues values. + * + * @return known AvailabilityStateValues values. + */ public static Collection values() { return values(AvailabilityStateValues.class); } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusListResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusListResult.java index 43f64d81834b..de3b5640969d 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusListResult.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusListResult.java @@ -20,12 +20,16 @@ public final class AvailabilityStatusListResult { private List value; /* - * The URI to fetch the next page of availabilityStatuses. Call ListNext() - * with this URI to fetch the next page of availabilityStatuses. + * The URI to fetch the next page of availabilityStatuses. Call ListNext() with this URI to fetch the next page of + * availabilityStatuses. */ @JsonProperty(value = "nextLink") private String nextLink; + /** Creates an instance of AvailabilityStatusListResult class. */ + public AvailabilityStatusListResult() { + } + /** * Get the value property: The list of availabilityStatuses. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusProperties.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusProperties.java index 9ca72b94ece6..bba9900c1c08 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusProperties.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusProperties.java @@ -13,8 +13,8 @@ @Fluent public final class AvailabilityStatusProperties { /* - * Availability status of the resource. When it is null, this - * availabilityStatus object represents an availability impacting event + * Availability status of the resource. When it is null, this availabilityStatus object represents an availability + * impacting event */ @JsonProperty(value = "availabilityState") private AvailabilityStateValues availabilityState; @@ -38,40 +38,36 @@ public final class AvailabilityStatusProperties { private String detailedStatus; /* - * When the resource's availabilityState is Unavailable, it describes where - * the health impacting event was originated. Examples are planned, - * unplanned, user initiated or an outage etc. + * When the resource's availabilityState is Unavailable, it describes where the health impacting event was + * originated. Examples are planned, unplanned, user initiated or an outage etc. */ @JsonProperty(value = "reasonType") private String reasonType; /* - * When the resource's availabilityState is Unavailable, it provides the - * Timestamp for when the health impacting event was received. + * When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting + * event was received. */ @JsonProperty(value = "rootCauseAttributionTime") private OffsetDateTime rootCauseAttributionTime; /* - * In case of an availability impacting event, it describes when the health - * impacting event was originated. Examples are Lifecycle, Downtime, Fault - * Analysis etc. + * In case of an availability impacting event, it describes when the health impacting event was originated. + * Examples are Lifecycle, Downtime, Fault Analysis etc. */ @JsonProperty(value = "healthEventType") private String healthEventType; /* - * In case of an availability impacting event, it describes where the - * health impacting event was originated. Examples are PlatformInitiated, - * UserInitiated etc. + * In case of an availability impacting event, it describes where the health impacting event was originated. + * Examples are PlatformInitiated, UserInitiated etc. */ @JsonProperty(value = "healthEventCause") private String healthEventCause; /* - * In case of an availability impacting event, it describes the category of - * a PlatformInitiated health impacting event. Examples are Planned, - * Unplanned etc. + * In case of an availability impacting event, it describes the category of a PlatformInitiated health impacting + * event. Examples are Planned, Unplanned etc. */ @JsonProperty(value = "healthEventCategory") private String healthEventCategory; @@ -83,9 +79,8 @@ public final class AvailabilityStatusProperties { private String healthEventId; /* - * When the resource's availabilityState is Unavailable and the reasonType - * is not User Initiated, it provides the date and time for when the issue - * is expected to be resolved. + * When the resource's availabilityState is Unavailable and the reasonType is not User Initiated, it provides the + * date and time for when the issue is expected to be resolved. */ @JsonProperty(value = "resolutionETA") private OffsetDateTime resolutionEta; @@ -93,8 +88,8 @@ public final class AvailabilityStatusProperties { /* * Timestamp for when last change in health status occurred. */ - @JsonProperty(value = "occurredTime") - private OffsetDateTime occurredTime; + @JsonProperty(value = "occuredTime") + private OffsetDateTime occuredTime; /* * Chronicity of the availability transition. @@ -109,26 +104,28 @@ public final class AvailabilityStatusProperties { private OffsetDateTime reportedTime; /* - * An annotation describing a change in the availabilityState to Available - * from Unavailable with a reasonType of type Unplanned + * An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of + * type Unplanned */ @JsonProperty(value = "recentlyResolved") private AvailabilityStatusPropertiesRecentlyResolved recentlyResolved; /* - * Lists actions the user can take based on the current availabilityState - * of the resource. + * Lists actions the user can take based on the current availabilityState of the resource. */ @JsonProperty(value = "recommendedActions") private List recommendedActions; /* - * Lists the service impacting events that may be affecting the health of - * the resource. + * Lists the service impacting events that may be affecting the health of the resource. */ @JsonProperty(value = "serviceImpactingEvents") private List serviceImpactingEvents; + /** Creates an instance of AvailabilityStatusProperties class. */ + public AvailabilityStatusProperties() { + } + /** * Get the availabilityState property: Availability status of the resource. When it is null, this availabilityStatus * object represents an availability impacting event. @@ -364,22 +361,22 @@ public AvailabilityStatusProperties withResolutionEta(OffsetDateTime resolutionE } /** - * Get the occurredTime property: Timestamp for when last change in health status occurred. + * Get the occuredTime property: Timestamp for when last change in health status occurred. * - * @return the occurredTime value. + * @return the occuredTime value. */ - public OffsetDateTime occurredTime() { - return this.occurredTime; + public OffsetDateTime occuredTime() { + return this.occuredTime; } /** - * Set the occurredTime property: Timestamp for when last change in health status occurred. + * Set the occuredTime property: Timestamp for when last change in health status occurred. * - * @param occurredTime the occurredTime value to set. + * @param occuredTime the occuredTime value to set. * @return the AvailabilityStatusProperties object itself. */ - public AvailabilityStatusProperties withOccurredTime(OffsetDateTime occurredTime) { - this.occurredTime = occurredTime; + public AvailabilityStatusProperties withOccuredTime(OffsetDateTime occuredTime) { + this.occuredTime = occuredTime; return this; } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusPropertiesRecentlyResolved.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusPropertiesRecentlyResolved.java index fe089240f681..493d529561bd 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusPropertiesRecentlyResolved.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatusPropertiesRecentlyResolved.java @@ -17,8 +17,8 @@ public final class AvailabilityStatusPropertiesRecentlyResolved { /* * Timestamp for when the availabilityState changed to Unavailable */ - @JsonProperty(value = "unavailableOccurredTime") - private OffsetDateTime unavailableOccurredTime; + @JsonProperty(value = "unavailableOccuredTime") + private OffsetDateTime unavailableOccuredTime; /* * Timestamp when the availabilityState changes to Available. @@ -29,27 +29,31 @@ public final class AvailabilityStatusPropertiesRecentlyResolved { /* * Brief description of cause of the resource becoming unavailable. */ - @JsonProperty(value = "unavailabilitySummary") - private String unavailabilitySummary; + @JsonProperty(value = "unavailableSummary") + private String unavailableSummary; + + /** Creates an instance of AvailabilityStatusPropertiesRecentlyResolved class. */ + public AvailabilityStatusPropertiesRecentlyResolved() { + } /** - * Get the unavailableOccurredTime property: Timestamp for when the availabilityState changed to Unavailable. + * Get the unavailableOccuredTime property: Timestamp for when the availabilityState changed to Unavailable. * - * @return the unavailableOccurredTime value. + * @return the unavailableOccuredTime value. */ - public OffsetDateTime unavailableOccurredTime() { - return this.unavailableOccurredTime; + public OffsetDateTime unavailableOccuredTime() { + return this.unavailableOccuredTime; } /** - * Set the unavailableOccurredTime property: Timestamp for when the availabilityState changed to Unavailable. + * Set the unavailableOccuredTime property: Timestamp for when the availabilityState changed to Unavailable. * - * @param unavailableOccurredTime the unavailableOccurredTime value to set. + * @param unavailableOccuredTime the unavailableOccuredTime value to set. * @return the AvailabilityStatusPropertiesRecentlyResolved object itself. */ - public AvailabilityStatusPropertiesRecentlyResolved withUnavailableOccurredTime( - OffsetDateTime unavailableOccurredTime) { - this.unavailableOccurredTime = unavailableOccurredTime; + public AvailabilityStatusPropertiesRecentlyResolved withUnavailableOccuredTime( + OffsetDateTime unavailableOccuredTime) { + this.unavailableOccuredTime = unavailableOccuredTime; return this; } @@ -74,22 +78,22 @@ public AvailabilityStatusPropertiesRecentlyResolved withResolvedTime(OffsetDateT } /** - * Get the unavailabilitySummary property: Brief description of cause of the resource becoming unavailable. + * Get the unavailableSummary property: Brief description of cause of the resource becoming unavailable. * - * @return the unavailabilitySummary value. + * @return the unavailableSummary value. */ - public String unavailabilitySummary() { - return this.unavailabilitySummary; + public String unavailableSummary() { + return this.unavailableSummary; } /** - * Set the unavailabilitySummary property: Brief description of cause of the resource becoming unavailable. + * Set the unavailableSummary property: Brief description of cause of the resource becoming unavailable. * - * @param unavailabilitySummary the unavailabilitySummary value to set. + * @param unavailableSummary the unavailableSummary value to set. * @return the AvailabilityStatusPropertiesRecentlyResolved object itself. */ - public AvailabilityStatusPropertiesRecentlyResolved withUnavailabilitySummary(String unavailabilitySummary) { - this.unavailabilitySummary = unavailabilitySummary; + public AvailabilityStatusPropertiesRecentlyResolved withUnavailableSummary(String unavailableSummary) { + this.unavailableSummary = unavailableSummary; return this; } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatuses.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatuses.java index 1088f560dd02..dfe1cdad0875 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatuses.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStatuses.java @@ -68,12 +68,17 @@ PagedIterable listByResourceGroup( * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} * and * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return current availability status for a single resource. + * @return current availability status for a single resource along with {@link Response}. */ - AvailabilityStatus getByResource(String resourceUri); + Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context); /** * Gets current availability status for a single resource. @@ -83,17 +88,12 @@ PagedIterable listByResourceGroup( * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} * and * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - * @param filter The filter to apply on the operation. For more information please see - * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return current availability status for a single resource along with {@link Response}. + * @return current availability status for a single resource. */ - Response getByResourceWithResponse( - String resourceUri, String filter, String expand, Context context); + AvailabilityStatus getByResource(String resourceUri); /** * Lists all historical availability transitions and impacting events for a single resource. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Event.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Event.java new file mode 100644 index 000000000000..7762c6dce5e5 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Event.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Event. */ +public interface Event { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the eventType property: Type of event. + * + * @return the eventType value. + */ + EventTypeValues eventType(); + + /** + * Gets the eventSource property: Source of event. + * + * @return the eventSource value. + */ + EventSourceValues eventSource(); + + /** + * Gets the status property: Current status of event. + * + * @return the status value. + */ + EventStatusValues status(); + + /** + * Gets the title property: Title text of event. + * + * @return the title value. + */ + String title(); + + /** + * Gets the summary property: Summary text of event. + * + * @return the summary value. + */ + String summary(); + + /** + * Gets the headerProperty property: Header text of event. + * + * @return the headerProperty value. + */ + String headerProperty(); + + /** + * Gets the level property: Level of insight. + * + * @return the level value. + */ + LevelValues level(); + + /** + * Gets the eventLevel property: Level of event. + * + * @return the eventLevel value. + */ + EventLevelValues eventLevel(); + + /** + * Gets the externalIncidentId property: The id of the Incident. + * + * @return the externalIncidentId value. + */ + String externalIncidentId(); + + /** + * Gets the article property: Article of event. + * + * @return the article value. + */ + EventPropertiesArticle article(); + + /** + * Gets the links property: Useful links of event. + * + * @return the links value. + */ + List links(); + + /** + * Gets the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @return the impactStartTime value. + */ + OffsetDateTime impactStartTime(); + + /** + * Gets the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @return the impactMitigationTime value. + */ + OffsetDateTime impactMitigationTime(); + + /** + * Gets the impact property: List services impacted by the service health event. + * + * @return the impact value. + */ + List impact(); + + /** + * Gets the recommendedActions property: Recommended actions of event. + * + * @return the recommendedActions value. + */ + EventPropertiesRecommendedActions recommendedActions(); + + /** + * Gets the faqs property: Frequently asked questions for the service health event. + * + * @return the faqs value. + */ + List faqs(); + + /** + * Gets the isHir property: It provides information if the event is High incident rate event or not. + * + * @return the isHir value. + */ + Boolean isHir(); + + /** + * Gets the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableMicrosoftSupport value. + */ + Boolean enableMicrosoftSupport(); + + /** + * Gets the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @return the description value. + */ + String description(); + + /** + * Gets the platformInitiated property: Is true if the event is platform initiated. + * + * @return the platformInitiated value. + */ + Boolean platformInitiated(); + + /** + * Gets the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableChatWithUs value. + */ + Boolean enableChatWithUs(); + + /** + * Gets the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @return the priority value. + */ + Integer priority(); + + /** + * Gets the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @return the lastUpdateTime value. + */ + OffsetDateTime lastUpdateTime(); + + /** + * Gets the hirStage property: Stage for HIR Document. + * + * @return the hirStage value. + */ + String hirStage(); + + /** + * Gets the additionalInformation property: Additional information. + * + * @return the additionalInformation value. + */ + EventPropertiesAdditionalInformation additionalInformation(); + + /** + * Gets the duration property: duration in seconds. + * + * @return the duration value. + */ + Integer duration(); + + /** + * Gets the impactType property: The type of the impact. + * + * @return the impactType value. + */ + String impactType(); + + /** + * Gets the inner com.azure.resourcemanager.resourcehealth.fluent.models.EventInner object. + * + * @return the inner object. + */ + EventInner innerModel(); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResource.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResource.java new file mode 100644 index 000000000000..f1ca85bc835c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResource.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import java.util.List; + +/** An immutable client-side representation of EventImpactedResource. */ +public interface EventImpactedResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the targetResourceType property: Resource type within Microsoft cloud. + * + * @return the targetResourceType value. + */ + String targetResourceType(); + + /** + * Gets the targetResourceId property: Identity for resource within Microsoft cloud. + * + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * Gets the targetRegion property: Impacted resource region name. + * + * @return the targetRegion value. + */ + String targetRegion(); + + /** + * Gets the info property: Additional information. + * + * @return the info value. + */ + List info(); + + /** + * Gets the inner com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner object. + * + * @return the inner object. + */ + EventImpactedResourceInner innerModel(); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResourceListResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResourceListResult.java new file mode 100644 index 000000000000..0e448b224ff1 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResourceListResult.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List of eventImpactedResources operation response. */ +@Fluent +public final class EventImpactedResourceListResult { + /* + * The list of eventImpactedResources. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of impacted + * resource. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of EventImpactedResourceListResult class. */ + public EventImpactedResourceListResult() { + } + + /** + * Get the value property: The list of eventImpactedResources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of eventImpactedResources. + * + * @param value the value value to set. + * @return the EventImpactedResourceListResult object itself. + */ + public EventImpactedResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the + * next page of impacted resource. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the + * next page of impacted resource. + * + * @param nextLink the nextLink value to set. + * @return the EventImpactedResourceListResult object itself. + */ + public EventImpactedResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model EventImpactedResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EventImpactedResourceListResult.class); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventLevelValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventLevelValues.java new file mode 100644 index 000000000000..4137a9bd9d9d --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventLevelValues.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Level of event. */ +public final class EventLevelValues extends ExpandableStringEnum { + /** Static value Critical for EventLevelValues. */ + public static final EventLevelValues CRITICAL = fromString("Critical"); + + /** Static value Error for EventLevelValues. */ + public static final EventLevelValues ERROR = fromString("Error"); + + /** Static value Warning for EventLevelValues. */ + public static final EventLevelValues WARNING = fromString("Warning"); + + /** Static value Informational for EventLevelValues. */ + public static final EventLevelValues INFORMATIONAL = fromString("Informational"); + + /** + * Creates or finds a EventLevelValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventLevelValues. + */ + @JsonCreator + public static EventLevelValues fromString(String name) { + return fromString(name, EventLevelValues.class); + } + + /** + * Gets known EventLevelValues values. + * + * @return known EventLevelValues values. + */ + public static Collection values() { + return values(EventLevelValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventOperations.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventOperations.java new file mode 100644 index 000000000000..ac40a763db6d --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventOperations.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of EventOperations. */ +public interface EventOperations { + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + Response getBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context); + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + Event getBySubscriptionIdAndTrackingId(String eventTrackingId); + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + Response getByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context); + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + Event getByTenantIdAndTrackingId(String eventTrackingId); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesAdditionalInformation.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesAdditionalInformation.java new file mode 100644 index 000000000000..c48d5cba6b41 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesAdditionalInformation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Additional information. */ +@Fluent +public final class EventPropertiesAdditionalInformation { + /* + * Additional information Message + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of EventPropertiesAdditionalInformation class. */ + public EventPropertiesAdditionalInformation() { + } + + /** + * Get the message property: Additional information Message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Additional information Message. + * + * @param message the message value to set. + * @return the EventPropertiesAdditionalInformation object itself. + */ + public EventPropertiesAdditionalInformation withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesArticle.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesArticle.java new file mode 100644 index 000000000000..234ca3ff362a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesArticle.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Article of event. */ +@Fluent +public final class EventPropertiesArticle { + /* + * Article content of event. + */ + @JsonProperty(value = "articleContent") + private String articleContent; + + /** Creates an instance of EventPropertiesArticle class. */ + public EventPropertiesArticle() { + } + + /** + * Get the articleContent property: Article content of event. + * + * @return the articleContent value. + */ + public String articleContent() { + return this.articleContent; + } + + /** + * Set the articleContent property: Article content of event. + * + * @param articleContent the articleContent value to set. + * @return the EventPropertiesArticle object itself. + */ + public EventPropertiesArticle withArticleContent(String articleContent) { + this.articleContent = articleContent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActions.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActions.java new file mode 100644 index 000000000000..faafb8efce10 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActions.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Recommended actions of event. */ +@Fluent +public final class EventPropertiesRecommendedActions { + /* + * Recommended action title for the service health event. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Recommended actions for the service health event. + */ + @JsonProperty(value = "actions") + private List actions; + + /* + * Recommended action locale for the service health event. + */ + @JsonProperty(value = "localeCode") + private String localeCode; + + /** Creates an instance of EventPropertiesRecommendedActions class. */ + public EventPropertiesRecommendedActions() { + } + + /** + * Get the message property: Recommended action title for the service health event. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Recommended action title for the service health event. + * + * @param message the message value to set. + * @return the EventPropertiesRecommendedActions object itself. + */ + public EventPropertiesRecommendedActions withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the actions property: Recommended actions for the service health event. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: Recommended actions for the service health event. + * + * @param actions the actions value to set. + * @return the EventPropertiesRecommendedActions object itself. + */ + public EventPropertiesRecommendedActions withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the localeCode property: Recommended action locale for the service health event. + * + * @return the localeCode value. + */ + public String localeCode() { + return this.localeCode; + } + + /** + * Set the localeCode property: Recommended action locale for the service health event. + * + * @param localeCode the localeCode value to set. + * @return the EventPropertiesRecommendedActions object itself. + */ + public EventPropertiesRecommendedActions withLocaleCode(String localeCode) { + this.localeCode = localeCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actions() != null) { + actions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActionsItem.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActionsItem.java new file mode 100644 index 000000000000..eeac97d0cfa8 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActionsItem.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Recommended action for the service health event. */ +@Fluent +public final class EventPropertiesRecommendedActionsItem { + /* + * Recommended action group Id for the service health event. + */ + @JsonProperty(value = "groupId") + private Integer groupId; + + /* + * Recommended action text + */ + @JsonProperty(value = "actionText") + private String actionText; + + /** Creates an instance of EventPropertiesRecommendedActionsItem class. */ + public EventPropertiesRecommendedActionsItem() { + } + + /** + * Get the groupId property: Recommended action group Id for the service health event. + * + * @return the groupId value. + */ + public Integer groupId() { + return this.groupId; + } + + /** + * Set the groupId property: Recommended action group Id for the service health event. + * + * @param groupId the groupId value to set. + * @return the EventPropertiesRecommendedActionsItem object itself. + */ + public EventPropertiesRecommendedActionsItem withGroupId(Integer groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the actionText property: Recommended action text. + * + * @return the actionText value. + */ + public String actionText() { + return this.actionText; + } + + /** + * Set the actionText property: Recommended action text. + * + * @param actionText the actionText value to set. + * @return the EventPropertiesRecommendedActionsItem object itself. + */ + public EventPropertiesRecommendedActionsItem withActionText(String actionText) { + this.actionText = actionText; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventSourceValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventSourceValues.java new file mode 100644 index 000000000000..939389ce4a42 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventSourceValues.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Source of event. */ +public final class EventSourceValues extends ExpandableStringEnum { + /** Static value ResourceHealth for EventSourceValues. */ + public static final EventSourceValues RESOURCE_HEALTH = fromString("ResourceHealth"); + + /** Static value ServiceHealth for EventSourceValues. */ + public static final EventSourceValues SERVICE_HEALTH = fromString("ServiceHealth"); + + /** + * Creates or finds a EventSourceValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventSourceValues. + */ + @JsonCreator + public static EventSourceValues fromString(String name) { + return fromString(name, EventSourceValues.class); + } + + /** + * Gets known EventSourceValues values. + * + * @return known EventSourceValues values. + */ + public static Collection values() { + return values(EventSourceValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventStatusValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventStatusValues.java new file mode 100644 index 000000000000..9d4489bcfe11 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventStatusValues.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Current status of event. */ +public final class EventStatusValues extends ExpandableStringEnum { + /** Static value Active for EventStatusValues. */ + public static final EventStatusValues ACTIVE = fromString("Active"); + + /** Static value Resolved for EventStatusValues. */ + public static final EventStatusValues RESOLVED = fromString("Resolved"); + + /** + * Creates or finds a EventStatusValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventStatusValues. + */ + @JsonCreator + public static EventStatusValues fromString(String name) { + return fromString(name, EventStatusValues.class); + } + + /** + * Gets known EventStatusValues values. + * + * @return known EventStatusValues values. + */ + public static Collection values() { + return values(EventStatusValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventTypeValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventTypeValues.java new file mode 100644 index 000000000000..9ce19ec48eb3 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventTypeValues.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of event. */ +public final class EventTypeValues extends ExpandableStringEnum { + /** Static value ServiceIssue for EventTypeValues. */ + public static final EventTypeValues SERVICE_ISSUE = fromString("ServiceIssue"); + + /** Static value PlannedMaintenance for EventTypeValues. */ + public static final EventTypeValues PLANNED_MAINTENANCE = fromString("PlannedMaintenance"); + + /** Static value HealthAdvisory for EventTypeValues. */ + public static final EventTypeValues HEALTH_ADVISORY = fromString("HealthAdvisory"); + + /** Static value RCA for EventTypeValues. */ + public static final EventTypeValues RCA = fromString("RCA"); + + /** Static value EmergingIssues for EventTypeValues. */ + public static final EventTypeValues EMERGING_ISSUES = fromString("EmergingIssues"); + + /** Static value SecurityAdvisory for EventTypeValues. */ + public static final EventTypeValues SECURITY_ADVISORY = fromString("SecurityAdvisory"); + + /** + * Creates or finds a EventTypeValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventTypeValues. + */ + @JsonCreator + public static EventTypeValues fromString(String name) { + return fromString(name, EventTypeValues.class); + } + + /** + * Gets known EventTypeValues values. + * + * @return known EventTypeValues values. + */ + public static Collection values() { + return values(EventTypeValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Events.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Events.java new file mode 100644 index 000000000000..2e3125b3caf7 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Events.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List events operation response. */ +@Fluent +public final class Events { + /* + * The list of event. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of events. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of Events class. */ + public Events() { + } + + /** + * Get the value property: The list of event. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of event. + * + * @param value the value value to set. + * @return the Events object itself. + */ + public Events withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the + * next page of events. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the + * next page of events. + * + * @param nextLink the nextLink value to set. + * @return the Events object itself. + */ + public Events withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property value in model Events")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Events.class); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventsOperations.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventsOperations.java new file mode 100644 index 000000000000..1d24892adbf7 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventsOperations.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of EventsOperations. */ +public interface EventsOperations { + /** + * Lists service health events in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter, String queryStartTime, Context context); + + /** + * Lists current service health events in the tenant. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTenantId(); + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTenantId(String filter, String queryStartTime, Context context); + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySingleResource(String resourceUri); + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySingleResource(String resourceUri, String filter, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Faq.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Faq.java new file mode 100644 index 000000000000..5d6a21f7fd07 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Faq.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Frequently asked question for the service health event. */ +@Fluent +public final class Faq { + /* + * FAQ question for the service health event. + */ + @JsonProperty(value = "question") + private String question; + + /* + * FAQ answer for the service health event. + */ + @JsonProperty(value = "answer") + private String answer; + + /* + * FAQ locale for the service health event. + */ + @JsonProperty(value = "localeCode") + private String localeCode; + + /** Creates an instance of Faq class. */ + public Faq() { + } + + /** + * Get the question property: FAQ question for the service health event. + * + * @return the question value. + */ + public String question() { + return this.question; + } + + /** + * Set the question property: FAQ question for the service health event. + * + * @param question the question value to set. + * @return the Faq object itself. + */ + public Faq withQuestion(String question) { + this.question = question; + return this; + } + + /** + * Get the answer property: FAQ answer for the service health event. + * + * @return the answer value. + */ + public String answer() { + return this.answer; + } + + /** + * Set the answer property: FAQ answer for the service health event. + * + * @param answer the answer value to set. + * @return the Faq object itself. + */ + public Faq withAnswer(String answer) { + this.answer = answer; + return this; + } + + /** + * Get the localeCode property: FAQ locale for the service health event. + * + * @return the localeCode value. + */ + public String localeCode() { + return this.localeCode; + } + + /** + * Set the localeCode property: FAQ locale for the service health event. + * + * @param localeCode the localeCode value to set. + * @return the Faq object itself. + */ + public Faq withLocaleCode(String localeCode) { + this.localeCode = localeCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Impact.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Impact.java new file mode 100644 index 000000000000..1ea271eef974 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Impact.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Azure service impacted by the service health event. */ +@Fluent +public final class Impact { + /* + * Impacted service name. + */ + @JsonProperty(value = "impactedService") + private String impactedService; + + /* + * List regions impacted by the service health event. + */ + @JsonProperty(value = "impactedRegions") + private List impactedRegions; + + /** Creates an instance of Impact class. */ + public Impact() { + } + + /** + * Get the impactedService property: Impacted service name. + * + * @return the impactedService value. + */ + public String impactedService() { + return this.impactedService; + } + + /** + * Set the impactedService property: Impacted service name. + * + * @param impactedService the impactedService value to set. + * @return the Impact object itself. + */ + public Impact withImpactedService(String impactedService) { + this.impactedService = impactedService; + return this; + } + + /** + * Get the impactedRegions property: List regions impacted by the service health event. + * + * @return the impactedRegions value. + */ + public List impactedRegions() { + return this.impactedRegions; + } + + /** + * Set the impactedRegions property: List regions impacted by the service health event. + * + * @param impactedRegions the impactedRegions value to set. + * @return the Impact object itself. + */ + public Impact withImpactedRegions(List impactedRegions) { + this.impactedRegions = impactedRegions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (impactedRegions() != null) { + impactedRegions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java new file mode 100644 index 000000000000..718abb1c6f0e --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ImpactedResources. */ +public interface ImpactedResources { + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event along with {@link Response}. + */ + Response getWithResponse( + String eventTrackingId, String impactedResourceName, Context context); + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event. + */ + EventImpactedResource get(String eventTrackingId, String impactedResourceName); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedServiceRegion.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedServiceRegion.java new file mode 100644 index 000000000000..c27aa373a5e0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedServiceRegion.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Azure region impacted by the service health event. */ +@Fluent +public final class ImpactedServiceRegion { + /* + * Impacted region name. + */ + @JsonProperty(value = "impactedRegion") + private String impactedRegion; + + /* + * Current status of event in the region. + */ + @JsonProperty(value = "status") + private EventStatusValues status; + + /* + * List subscription impacted by the service health event. + */ + @JsonProperty(value = "impactedSubscriptions") + private List impactedSubscriptions; + + /* + * List tenant impacted by the service health event. + */ + @JsonProperty(value = "impactedTenants") + private List impactedTenants; + + /* + * It provides the Timestamp for when the last update for the service health event. + */ + @JsonProperty(value = "lastUpdateTime") + private OffsetDateTime lastUpdateTime; + + /* + * List of updates for given service health event. + */ + @JsonProperty(value = "updates") + private List updates; + + /** Creates an instance of ImpactedServiceRegion class. */ + public ImpactedServiceRegion() { + } + + /** + * Get the impactedRegion property: Impacted region name. + * + * @return the impactedRegion value. + */ + public String impactedRegion() { + return this.impactedRegion; + } + + /** + * Set the impactedRegion property: Impacted region name. + * + * @param impactedRegion the impactedRegion value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withImpactedRegion(String impactedRegion) { + this.impactedRegion = impactedRegion; + return this; + } + + /** + * Get the status property: Current status of event in the region. + * + * @return the status value. + */ + public EventStatusValues status() { + return this.status; + } + + /** + * Set the status property: Current status of event in the region. + * + * @param status the status value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withStatus(EventStatusValues status) { + this.status = status; + return this; + } + + /** + * Get the impactedSubscriptions property: List subscription impacted by the service health event. + * + * @return the impactedSubscriptions value. + */ + public List impactedSubscriptions() { + return this.impactedSubscriptions; + } + + /** + * Set the impactedSubscriptions property: List subscription impacted by the service health event. + * + * @param impactedSubscriptions the impactedSubscriptions value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withImpactedSubscriptions(List impactedSubscriptions) { + this.impactedSubscriptions = impactedSubscriptions; + return this; + } + + /** + * Get the impactedTenants property: List tenant impacted by the service health event. + * + * @return the impactedTenants value. + */ + public List impactedTenants() { + return this.impactedTenants; + } + + /** + * Set the impactedTenants property: List tenant impacted by the service health event. + * + * @param impactedTenants the impactedTenants value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withImpactedTenants(List impactedTenants) { + this.impactedTenants = impactedTenants; + return this; + } + + /** + * Get the lastUpdateTime property: It provides the Timestamp for when the last update for the service health event. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime property: It provides the Timestamp for when the last update for the service health event. + * + * @param lastUpdateTime the lastUpdateTime value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withLastUpdateTime(OffsetDateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the updates property: List of updates for given service health event. + * + * @return the updates value. + */ + public List updates() { + return this.updates; + } + + /** + * Set the updates property: List of updates for given service health event. + * + * @param updates the updates value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withUpdates(List updates) { + this.updates = updates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (updates() != null) { + updates().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/KeyValueItem.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/KeyValueItem.java new file mode 100644 index 000000000000..4fea7218ff7d --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/KeyValueItem.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Key value tuple. */ +@Immutable +public final class KeyValueItem { + /* + * Key of tuple. + */ + @JsonProperty(value = "key", access = JsonProperty.Access.WRITE_ONLY) + private String key; + + /* + * Value of tuple. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** Creates an instance of KeyValueItem class. */ + public KeyValueItem() { + } + + /** + * Get the key property: Key of tuple. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Get the value property: Value of tuple. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LevelValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LevelValues.java new file mode 100644 index 000000000000..6261eb7793d1 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LevelValues.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Level of insight. */ +public final class LevelValues extends ExpandableStringEnum { + /** Static value Critical for LevelValues. */ + public static final LevelValues CRITICAL = fromString("Critical"); + + /** Static value Warning for LevelValues. */ + public static final LevelValues WARNING = fromString("Warning"); + + /** + * Creates or finds a LevelValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding LevelValues. + */ + @JsonCreator + public static LevelValues fromString(String name) { + return fromString(name, LevelValues.class); + } + + /** + * Gets known LevelValues values. + * + * @return known LevelValues values. + */ + public static Collection values() { + return values(LevelValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Link.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Link.java new file mode 100644 index 000000000000..80383e2e5ca4 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Link.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Useful links for service health event. */ +@Fluent +public final class Link { + /* + * Type of link. + */ + @JsonProperty(value = "type") + private LinkTypeValues type; + + /* + * Display text of link. + */ + @JsonProperty(value = "displayText") + private LinkDisplayText displayText; + + /* + * It provides the name of portal extension to produce link for given service health event. + */ + @JsonProperty(value = "extensionName") + private String extensionName; + + /* + * It provides the name of portal extension blade to produce link for given service health event. + */ + @JsonProperty(value = "bladeName") + private String bladeName; + + /* + * It provides a map of parameter name and value for portal extension blade to produce lik for given service health + * event. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** Creates an instance of Link class. */ + public Link() { + } + + /** + * Get the type property: Type of link. + * + * @return the type value. + */ + public LinkTypeValues type() { + return this.type; + } + + /** + * Set the type property: Type of link. + * + * @param type the type value to set. + * @return the Link object itself. + */ + public Link withType(LinkTypeValues type) { + this.type = type; + return this; + } + + /** + * Get the displayText property: Display text of link. + * + * @return the displayText value. + */ + public LinkDisplayText displayText() { + return this.displayText; + } + + /** + * Set the displayText property: Display text of link. + * + * @param displayText the displayText value to set. + * @return the Link object itself. + */ + public Link withDisplayText(LinkDisplayText displayText) { + this.displayText = displayText; + return this; + } + + /** + * Get the extensionName property: It provides the name of portal extension to produce link for given service health + * event. + * + * @return the extensionName value. + */ + public String extensionName() { + return this.extensionName; + } + + /** + * Set the extensionName property: It provides the name of portal extension to produce link for given service health + * event. + * + * @param extensionName the extensionName value to set. + * @return the Link object itself. + */ + public Link withExtensionName(String extensionName) { + this.extensionName = extensionName; + return this; + } + + /** + * Get the bladeName property: It provides the name of portal extension blade to produce link for given service + * health event. + * + * @return the bladeName value. + */ + public String bladeName() { + return this.bladeName; + } + + /** + * Set the bladeName property: It provides the name of portal extension blade to produce link for given service + * health event. + * + * @param bladeName the bladeName value to set. + * @return the Link object itself. + */ + public Link withBladeName(String bladeName) { + this.bladeName = bladeName; + return this; + } + + /** + * Get the parameters property: It provides a map of parameter name and value for portal extension blade to produce + * lik for given service health event. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: It provides a map of parameter name and value for portal extension blade to produce + * lik for given service health event. + * + * @param parameters the parameters value to set. + * @return the Link object itself. + */ + public Link withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayText() != null) { + displayText().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkDisplayText.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkDisplayText.java new file mode 100644 index 000000000000..99a5715978fd --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkDisplayText.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display text of link. */ +@Fluent +public final class LinkDisplayText { + /* + * Display text of link. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Localized display text of link. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** Creates an instance of LinkDisplayText class. */ + public LinkDisplayText() { + } + + /** + * Get the value property: Display text of link. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Display text of link. + * + * @param value the value value to set. + * @return the LinkDisplayText object itself. + */ + public LinkDisplayText withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: Localized display text of link. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: Localized display text of link. + * + * @param localizedValue the localizedValue value to set. + * @return the LinkDisplayText object itself. + */ + public LinkDisplayText withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkTypeValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkTypeValues.java new file mode 100644 index 000000000000..f891a82cdd9f --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkTypeValues.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of link. */ +public final class LinkTypeValues extends ExpandableStringEnum { + /** Static value Button for LinkTypeValues. */ + public static final LinkTypeValues BUTTON = fromString("Button"); + + /** Static value Hyperlink for LinkTypeValues. */ + public static final LinkTypeValues HYPERLINK = fromString("Hyperlink"); + + /** + * Creates or finds a LinkTypeValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinkTypeValues. + */ + @JsonCreator + public static LinkTypeValues fromString(String name) { + return fromString(name, LinkTypeValues.class); + } + + /** + * Gets known LinkTypeValues values. + * + * @return known LinkTypeValues values. + */ + public static Collection values() { + return values(LinkTypeValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Operation.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Operation.java index 9c8d3433857f..579057296d4a 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Operation.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Operation.java @@ -22,6 +22,10 @@ public final class Operation { @JsonProperty(value = "display") private OperationDisplay display; + /** Creates an instance of Operation class. */ + public Operation() { + } + /** * Get the name property: Name of the operation. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/OperationDisplay.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/OperationDisplay.java index 8b706512782f..359f6b37a0a6 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/OperationDisplay.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/OperationDisplay.java @@ -34,6 +34,10 @@ public final class OperationDisplay { @JsonProperty(value = "description") private String description; + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + /** * Get the provider property: Provider name. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Operations.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Operations.java index f519977cc1a3..f4c108f07c95 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Operations.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Operations.java @@ -12,20 +12,20 @@ public interface Operations { /** * Lists available operations for the resourcehealth resource provider. * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return lists the operations response. + * @return lists the operations response along with {@link Response}. */ - OperationListResult list(); + Response listWithResponse(Context context); /** * Lists available operations for the resourcehealth resource provider. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return lists the operations response along with {@link Response}. + * @return lists the operations response. */ - Response listWithResponse(Context context); + OperationListResult list(); } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ReasonChronicityTypes.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ReasonChronicityTypes.java index e3ff6160b649..136088ae0ecd 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ReasonChronicityTypes.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ReasonChronicityTypes.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ReasonChronicityTypes. */ +/** Chronicity of the availability transition. */ public final class ReasonChronicityTypes extends ExpandableStringEnum { /** Static value Transient for ReasonChronicityTypes. */ public static final ReasonChronicityTypes TRANSIENT = fromString("Transient"); @@ -27,7 +27,11 @@ public static ReasonChronicityTypes fromString(String name) { return fromString(name, ReasonChronicityTypes.class); } - /** @return known ReasonChronicityTypes values. */ + /** + * Gets known ReasonChronicityTypes values. + * + * @return known ReasonChronicityTypes values. + */ public static Collection values() { return values(ReasonChronicityTypes.class); } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/RecommendedAction.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/RecommendedAction.java index b2b7307aeb6f..7e75ca66894b 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/RecommendedAction.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/RecommendedAction.java @@ -28,6 +28,10 @@ public final class RecommendedAction { @JsonProperty(value = "actionUrlText") private String actionUrlText; + /** Creates an instance of RecommendedAction class. */ + public RecommendedAction() { + } + /** * Get the action property: Recommended action. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEvent.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEvent.java index 314eb06f09d2..aa0c91ae0a39 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEvent.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEvent.java @@ -41,6 +41,10 @@ public final class ServiceImpactingEvent { @JsonProperty(value = "incidentProperties") private ServiceImpactingEventIncidentProperties incidentProperties; + /** Creates an instance of ServiceImpactingEvent class. */ + public ServiceImpactingEvent() { + } + /** * Get the eventStartTime property: Timestamp for when the event started. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEventIncidentProperties.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEventIncidentProperties.java index 2c1a0260dd36..e460d264833d 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEventIncidentProperties.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEventIncidentProperties.java @@ -34,6 +34,10 @@ public final class ServiceImpactingEventIncidentProperties { @JsonProperty(value = "incidentType") private String incidentType; + /** Creates an instance of ServiceImpactingEventIncidentProperties class. */ + public ServiceImpactingEventIncidentProperties() { + } + /** * Get the title property: Title of the incident. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEventStatus.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEventStatus.java index 28965361551c..c5a6c1ba9b7e 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEventStatus.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ServiceImpactingEventStatus.java @@ -16,6 +16,10 @@ public final class ServiceImpactingEventStatus { @JsonProperty(value = "value") private String value; + /** Creates an instance of ServiceImpactingEventStatus class. */ + public ServiceImpactingEventStatus() { + } + /** * Get the value property: Current status of the event. * diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Update.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Update.java new file mode 100644 index 000000000000..54ab9b05a0fc --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Update.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Update for service health event. */ +@Fluent +public final class Update { + /* + * Summary text for the given update for the service health event. + */ + @JsonProperty(value = "summary") + private String summary; + + /* + * It provides the Timestamp for the given update for the service health event. + */ + @JsonProperty(value = "updateDateTime") + private OffsetDateTime updateDateTime; + + /** Creates an instance of Update class. */ + public Update() { + } + + /** + * Get the summary property: Summary text for the given update for the service health event. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Set the summary property: Summary text for the given update for the service health event. + * + * @param summary the summary value to set. + * @return the Update object itself. + */ + public Update withSummary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get the updateDateTime property: It provides the Timestamp for the given update for the service health event. + * + * @return the updateDateTime value. + */ + public OffsetDateTime updateDateTime() { + return this.updateDateTime; + } + + /** + * Set the updateDateTime property: It provides the Timestamp for the given update for the service health event. + * + * @param updateDateTime the updateDateTime value to set. + * @return the Update object itself. + */ + public Update withUpdateDateTime(OffsetDateTime updateDateTime) { + this.updateDateTime = updateDateTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesGetByResourceSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesGetByResourceSamples.java index e707e8bccfb3..c14b4036cc20 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesGetByResourceSamples.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesGetByResourceSamples.java @@ -9,7 +9,7 @@ /** Samples for AvailabilityStatuses GetByResource. */ public final class AvailabilityStatusesGetByResourceSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatus_GetByResource.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatus_GetByResource.json */ /** * Sample code: GetCurrentHealthByResource. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListByResourceGroupSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListByResourceGroupSamples.java index ed3c63e5212f..e227526ef7bb 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListByResourceGroupSamples.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListByResourceGroupSamples.java @@ -9,7 +9,7 @@ /** Samples for AvailabilityStatuses ListByResourceGroup. */ public final class AvailabilityStatusesListByResourceGroupSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_ListByResourceGroup.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatuses_ListByResourceGroup.json */ /** * Sample code: ListByResourceGroup. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListBySubscriptionIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListBySubscriptionIdSamples.java index f7d5dc182ba0..53e45091c150 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListBySubscriptionIdSamples.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListBySubscriptionIdSamples.java @@ -9,7 +9,7 @@ /** Samples for AvailabilityStatuses ListBySubscriptionId. */ public final class AvailabilityStatusesListBySubscriptionIdSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_ListBySubscriptionId.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatuses_ListBySubscriptionId.json */ /** * Sample code: ListHealthBySubscriptionId. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListSamples.java index 7e9cbd1475dd..dca236bbc2e2 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListSamples.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListSamples.java @@ -9,7 +9,7 @@ /** Samples for AvailabilityStatuses List. */ public final class AvailabilityStatusesListSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_List.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatuses_List.json */ /** * Sample code: GetHealthHistoryByResource. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetBySubscriptionIdAndTrackingIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetBySubscriptionIdAndTrackingIdSamples.java new file mode 100644 index 000000000000..dbc9ab02d8f1 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetBySubscriptionIdAndTrackingIdSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.Context; + +/** Samples for EventOperation GetBySubscriptionIdAndTrackingId. */ +public final class EventOperationGetBySubscriptionIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json + */ + /** + * Sample code: SecurityAdvisoriesEventBySubscriptionIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void securityAdvisoriesEventBySubscriptionIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .getBySubscriptionIdAndTrackingIdWithResponse( + "eventTrackingId", "properties/status eq 'Active'", "7/10/2022", Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetByTenantIdAndTrackingIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetByTenantIdAndTrackingIdSamples.java new file mode 100644 index 000000000000..196ac0b39ef1 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetByTenantIdAndTrackingIdSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.Context; + +/** Samples for EventOperation GetByTenantIdAndTrackingId. */ +public final class EventOperationGetByTenantIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json + */ + /** + * Sample code: EventByTenantIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventByTenantIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .getByTenantIdAndTrackingIdWithResponse( + "eventTrackingId", "properties/status eq 'Active'", "7/10/2022", Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListBySingleResourceSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListBySingleResourceSamples.java new file mode 100644 index 000000000000..6512900f6df2 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListBySingleResourceSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.Context; + +/** Samples for EventsOperation ListBySingleResource. */ +public final class EventsOperationListBySingleResourceSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Events_ListBySingleResource.json + */ + /** + * Sample code: ListEventsBySingleResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsBySingleResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .listBySingleResource( + "subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI", + null, + Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListByTenantIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListByTenantIdSamples.java new file mode 100644 index 000000000000..95d26ccd7f64 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListByTenantIdSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.Context; + +/** Samples for EventsOperation ListByTenantId. */ +public final class EventsOperationListByTenantIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Events_ListByTenantId.json + */ + /** + * Sample code: ListEventsByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsByTenantId(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .listByTenantId("service eq 'Virtual Machines' or region eq 'West US'", "7/24/2020", Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListSamples.java new file mode 100644 index 000000000000..6007a8966247 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.Context; + +/** Samples for EventsOperation List. */ +public final class EventsOperationListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Events_ListBySubscriptionId.json + */ + /** + * Sample code: ListEventsBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .list("service eq 'Virtual Machines' or region eq 'West US'", "7/24/2020", Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetSamples.java new file mode 100644 index 000000000000..b2c0e0d8bfd4 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.Context; + +/** Samples for ImpactedResources Get. */ +public final class ImpactedResourcesGetSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_Get.json + */ + /** + * Sample code: ImpactedResourcesGet. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void impactedResourcesGet(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.impactedResources().getWithResponse("BC_1-FXZ", "abc-123-ghj-456", Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdSamples.java new file mode 100644 index 000000000000..58f9a03718a3 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.Context; + +/** Samples for ImpactedResources ListBySubscriptionIdAndEventId. */ +public final class ImpactedResourcesListBySubscriptionIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json + */ + /** + * Sample code: ListImpactedResourcesBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listImpactedResourcesBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .listBySubscriptionIdAndEventId("BC_1-FXZ", "targetRegion eq 'westus'", Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/OperationsListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/OperationsListSamples.java index e3e59d5e252c..75770092ad3c 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/OperationsListSamples.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/OperationsListSamples.java @@ -9,15 +9,14 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/Operations_List.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Operations_List.json */ /** - * Sample code: GetHealthHistoryByResource. + * Sample code: GetOperationsList. * * @param manager Entry point to ResourceHealthManager. */ - public static void getHealthHistoryByResource( - com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + public static void getOperationsList(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { manager.operations().listWithResponse(Context.NONE); } }