diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/CHANGELOG.md b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/CHANGELOG.md index 5837aa17f127..711bf434fa9a 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/CHANGELOG.md +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2023-05-04) + +- 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-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 076730b3c213..82832a5d5664 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-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 + 1.1.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/SAMPLE.md b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/SAMPLE.md index 1be5f265d1a5..f37cba6bb343 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/SAMPLE.md +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/SAMPLE.md @@ -8,18 +8,60 @@ - [ListByResourceGroup](#availabilitystatuses_listbyresourcegroup) - [ListBySubscriptionId](#availabilitystatuses_listbysubscriptionid) +## ChildAvailabilityStatuses + +- [GetByResource](#childavailabilitystatuses_getbyresource) +- [List](#childavailabilitystatuses_list) + +## ChildResources + +- [List](#childresources_list) + +## EmergingIssues + +- [Get](#emergingissues_get) +- [List](#emergingissues_list) + +## EventOperation + +- [FetchDetailsBySubscriptionIdAndTrackingId](#eventoperation_fetchdetailsbysubscriptionidandtrackingid) +- [FetchDetailsByTenantIdAndTrackingId](#eventoperation_fetchdetailsbytenantidandtrackingid) +- [GetBySubscriptionIdAndTrackingId](#eventoperation_getbysubscriptionidandtrackingid) +- [GetByTenantIdAndTrackingId](#eventoperation_getbytenantidandtrackingid) + +## EventsOperation + +- [List](#eventsoperation_list) +- [ListBySingleResource](#eventsoperation_listbysingleresource) +- [ListByTenantId](#eventsoperation_listbytenantid) + +## ImpactedResources + +- [Get](#impactedresources_get) +- [GetByTenantId](#impactedresources_getbytenantid) +- [ListBySubscriptionIdAndEventId](#impactedresources_listbysubscriptionidandeventid) +- [ListByTenantIdAndEventId](#impactedresources_listbytenantidandeventid) + +## Metadata + +- [GetEntity](#metadata_getentity) +- [List](#metadata_list) + ## Operations - [List](#operations_list) + +## SecurityAdvisoryImpactedResources + +- [ListBySubscriptionIdAndEventId](#securityadvisoryimpactedresources_listbysubscriptionidandeventid) +- [ListByTenantIdAndEventId](#securityadvisoryimpactedresources_listbytenantidandeventid) ### AvailabilityStatuses_GetByResource ```java -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/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json */ /** * Sample code: GetCurrentHealthByResource. @@ -30,7 +72,7 @@ public final class AvailabilityStatusesGetByResourceSamples { com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { manager .availabilityStatuses() - .getByResourceWithResponse("resourceUri", null, "recommendedactions", Context.NONE); + .getByResourceWithResponse("resourceUri", null, "recommendedactions", com.azure.core.util.Context.NONE); } } ``` @@ -38,12 +80,10 @@ public final class AvailabilityStatusesGetByResourceSamples { ### AvailabilityStatuses_List ```java -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/stable/2022-10-01/examples/AvailabilityStatuses_List.json */ /** * Sample code: GetHealthHistoryByResource. @@ -52,7 +92,7 @@ public final class AvailabilityStatusesListSamples { */ public static void getHealthHistoryByResource( com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { - manager.availabilityStatuses().list("resourceUri", null, null, Context.NONE); + manager.availabilityStatuses().list("resourceUri", null, null, com.azure.core.util.Context.NONE); } } ``` @@ -60,12 +100,10 @@ public final class AvailabilityStatusesListSamples { ### AvailabilityStatuses_ListByResourceGroup ```java -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/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json */ /** * Sample code: ListByResourceGroup. @@ -75,7 +113,7 @@ public final class AvailabilityStatusesListByResourceGroupSamples { public static void listByResourceGroup(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { manager .availabilityStatuses() - .listByResourceGroup("resourceGroupName", null, "recommendedactions", Context.NONE); + .listByResourceGroup("resourceGroupName", null, "recommendedactions", com.azure.core.util.Context.NONE); } } ``` @@ -83,12 +121,10 @@ public final class AvailabilityStatusesListByResourceGroupSamples { ### AvailabilityStatuses_ListBySubscriptionId ```java -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/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json */ /** * Sample code: ListHealthBySubscriptionId. @@ -97,29 +133,465 @@ public final class AvailabilityStatusesListBySubscriptionIdSamples { */ public static void listHealthBySubscriptionId( com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { - manager.availabilityStatuses().listBySubscriptionId(null, "recommendedactions", Context.NONE); + manager + .availabilityStatuses() + .listBySubscriptionId(null, "recommendedactions", com.azure.core.util.Context.NONE); } } ``` -### Operations_List +### ChildAvailabilityStatuses_GetByResource + +```java +/** Samples for ChildAvailabilityStatuses GetByResource. */ +public final class ChildAvailabilityStatusesGetByResourceSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json + */ + /** + * Sample code: GetChildCurrentHealthByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getChildCurrentHealthByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .childAvailabilityStatuses() + .getByResourceWithResponse( + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", + null, + "recommendedactions", + com.azure.core.util.Context.NONE); + } +} +``` + +### ChildAvailabilityStatuses_List + +```java +/** Samples for ChildAvailabilityStatuses List. */ +public final class ChildAvailabilityStatusesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json + */ + /** + * Sample code: GetChildHealthHistoryByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getChildHealthHistoryByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .childAvailabilityStatuses() + .list( + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### ChildResources_List + +```java +/** Samples for ChildResources List. */ +public final class ChildResourcesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json + */ + /** + * Sample code: GetCurrentChildHealthByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getCurrentChildHealthByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.childResources().list("resourceUri", null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### EmergingIssues_Get + +```java +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; + +/** Samples for EmergingIssues Get. */ +public final class EmergingIssuesGetSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + */ + /** + * Sample code: GetEmergingIssues. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getEmergingIssues(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.emergingIssues().getWithResponse(IssueNameParameter.DEFAULT, com.azure.core.util.Context.NONE); + } +} +``` + +### EmergingIssues_List ```java -import com.azure.core.util.Context; +/** Samples for EmergingIssues List. */ +public final class EmergingIssuesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json + */ + /** + * Sample code: GetEmergingIssues. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getEmergingIssues(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.emergingIssues().list(com.azure.core.util.Context.NONE); + } +} +``` +### EventOperation_FetchDetailsBySubscriptionIdAndTrackingId + +```java +/** Samples for EventOperation FetchDetailsBySubscriptionIdAndTrackingId. */ +public final class EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json + */ + /** + * Sample code: EventDetailsBySubscriptionIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventDetailsBySubscriptionIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .fetchDetailsBySubscriptionIdAndTrackingIdWithResponse("eventTrackingId", com.azure.core.util.Context.NONE); + } +} +``` + +### EventOperation_FetchDetailsByTenantIdAndTrackingId + +```java +/** Samples for EventOperation FetchDetailsByTenantIdAndTrackingId. */ +public final class EventOperationFetchDetailsByTenantIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json + */ + /** + * Sample code: EventDetailsByTenantIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventDetailsByTenantIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .fetchDetailsByTenantIdAndTrackingIdWithResponse("eventTrackingId", com.azure.core.util.Context.NONE); + } +} +``` + +### EventOperation_GetBySubscriptionIdAndTrackingId + +```java +/** Samples for EventOperation GetBySubscriptionIdAndTrackingId. */ +public final class EventOperationGetBySubscriptionIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.Context.NONE); + } +} +``` + +### EventOperation_GetByTenantIdAndTrackingId + +```java +/** Samples for EventOperation GetByTenantIdAndTrackingId. */ +public final class EventOperationGetByTenantIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.Context.NONE); + } +} +``` + +### EventsOperation_List + +```java +/** Samples for EventsOperation List. */ +public final class EventsOperationListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.Context.NONE); + } +} +``` + +### EventsOperation_ListBySingleResource + +```java +/** Samples for EventsOperation ListBySingleResource. */ +public final class EventsOperationListBySingleResourceSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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, + com.azure.core.util.Context.NONE); + } +} +``` + +### EventsOperation_ListByTenantId + +```java +/** Samples for EventsOperation ListByTenantId. */ +public final class EventsOperationListByTenantIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.Context.NONE); + } +} +``` + +### ImpactedResources_Get + +```java +/** Samples for ImpactedResources Get. */ +public final class ImpactedResourcesGetSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.Context.NONE); + } +} +``` + +### ImpactedResources_GetByTenantId + +```java +/** Samples for ImpactedResources GetByTenantId. */ +public final class ImpactedResourcesGetByTenantIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + */ + /** + * Sample code: ImpactedResourcesGet. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void impactedResourcesGet(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .getByTenantIdWithResponse("BC_1-FXZ", "abc-123-ghj-456", com.azure.core.util.Context.NONE); + } +} +``` + +### ImpactedResources_ListBySubscriptionIdAndEventId + +```java +/** Samples for ImpactedResources ListBySubscriptionIdAndEventId. */ +public final class ImpactedResourcesListBySubscriptionIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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'", com.azure.core.util.Context.NONE); + } +} +``` + +### ImpactedResources_ListByTenantIdAndEventId + +```java +/** Samples for ImpactedResources ListByTenantIdAndEventId. */ +public final class ImpactedResourcesListByTenantIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json + */ + /** + * Sample code: ListEventsByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsByTenantId(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .listByTenantIdAndEventId("BC_1-FXZ", "targetRegion eq 'westus'", com.azure.core.util.Context.NONE); + } +} +``` + +### Metadata_GetEntity + +```java +/** Samples for Metadata GetEntity. */ +public final class MetadataGetEntitySamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + */ + /** + * Sample code: GetMetadata. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getMetadata(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.metadatas().getEntityWithResponse("status", com.azure.core.util.Context.NONE); + } +} +``` + +### Metadata_List + +```java +/** Samples for Metadata List. */ +public final class MetadataListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json + */ + /** + * Sample code: GetMetadata. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getMetadata(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.metadatas().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java /** 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/stable/2022-10-01/examples/Operations_List.json */ /** - * Sample code: GetHealthHistoryByResource. + * Sample code: GetOperationsList. * * @param manager Entry point to ResourceHealthManager. */ - public static void getHealthHistoryByResource( + public static void getOperationsList(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityAdvisoryImpactedResources_ListBySubscriptionIdAndEventId + +```java +/** Samples for SecurityAdvisoryImpactedResources ListBySubscriptionIdAndEventId. */ +public final class SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json + */ + /** + * Sample code: ListSecurityAdvisoryImpactedResourcesBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listSecurityAdvisoryImpactedResourcesBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .securityAdvisoryImpactedResources() + .listBySubscriptionIdAndEventId("BC_1-FXZ", null, com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityAdvisoryImpactedResources_ListByTenantIdAndEventId + +```java +/** Samples for SecurityAdvisoryImpactedResources ListByTenantIdAndEventId. */ +public final class SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json + */ + /** + * Sample code: ListSecurityAdvisoryImpactedResourcesByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listSecurityAdvisoryImpactedResourcesByTenantId( com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { - manager.operations().listWithResponse(Context.NONE); + manager + .securityAdvisoryImpactedResources() + .listByTenantIdAndEventId("BC_1-FXZ", null, com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml index 32f8d1f9f0ce..a4170aebbac2 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml @@ -1,3 +1,8 @@ + 4.0.0 @@ -13,7 +18,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-2022-10. https://github.com/Azure/azure-sdk-for-java @@ -38,7 +43,8 @@ UTF-8 - true + 0 + 0 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 dc023b124d0b..4ca9e2b07c9f 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 @@ -25,10 +25,26 @@ 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.ChildAvailabilityStatusesImpl; +import com.azure.resourcemanager.resourcehealth.implementation.ChildResourcesImpl; +import com.azure.resourcemanager.resourcehealth.implementation.EmergingIssuesImpl; +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.MetadatasImpl; import com.azure.resourcemanager.resourcehealth.implementation.MicrosoftResourceHealthBuilder; import com.azure.resourcemanager.resourcehealth.implementation.OperationsImpl; +import com.azure.resourcemanager.resourcehealth.implementation.SecurityAdvisoryImpactedResourcesImpl; import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatuses; +import com.azure.resourcemanager.resourcehealth.models.ChildAvailabilityStatuses; +import com.azure.resourcemanager.resourcehealth.models.ChildResources; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssues; +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.Metadatas; import com.azure.resourcemanager.resourcehealth.models.Operations; +import com.azure.resourcemanager.resourcehealth.models.SecurityAdvisoryImpactedResources; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -42,6 +58,22 @@ public final class ResourceHealthManager { private Operations operations; + private Metadatas metadatas; + + private ImpactedResources impactedResources; + + private SecurityAdvisoryImpactedResources securityAdvisoryImpactedResources; + + private EventsOperations eventsOperations; + + private EventOperations eventOperations; + + private ChildAvailabilityStatuses childAvailabilityStatuses; + + private ChildResources childResources; + + private EmergingIssues emergingIssues; + private final MicrosoftResourceHealth clientObject; private ResourceHealthManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -207,7 +239,7 @@ public ResourceHealthManager authenticate(TokenCredential credential, AzureProfi .append("-") .append("com.azure.resourcemanager.resourcehealth") .append("/") - .append("1.0.0"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -288,6 +320,104 @@ public Operations operations() { return operations; } + /** + * Gets the resource collection API of Metadatas. + * + * @return Resource collection API of Metadatas. + */ + public Metadatas metadatas() { + if (this.metadatas == null) { + this.metadatas = new MetadatasImpl(clientObject.getMetadatas(), this); + } + return metadatas; + } + + /** + * 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 SecurityAdvisoryImpactedResources. + * + * @return Resource collection API of SecurityAdvisoryImpactedResources. + */ + public SecurityAdvisoryImpactedResources securityAdvisoryImpactedResources() { + if (this.securityAdvisoryImpactedResources == null) { + this.securityAdvisoryImpactedResources = + new SecurityAdvisoryImpactedResourcesImpl(clientObject.getSecurityAdvisoryImpactedResources(), this); + } + return securityAdvisoryImpactedResources; + } + + /** + * 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; + } + + /** + * Gets the resource collection API of ChildAvailabilityStatuses. + * + * @return Resource collection API of ChildAvailabilityStatuses. + */ + public ChildAvailabilityStatuses childAvailabilityStatuses() { + if (this.childAvailabilityStatuses == null) { + this.childAvailabilityStatuses = + new ChildAvailabilityStatusesImpl(clientObject.getChildAvailabilityStatuses(), this); + } + return childAvailabilityStatuses; + } + + /** + * Gets the resource collection API of ChildResources. + * + * @return Resource collection API of ChildResources. + */ + public ChildResources childResources() { + if (this.childResources == null) { + this.childResources = new ChildResourcesImpl(clientObject.getChildResources(), this); + } + return childResources; + } + + /** + * Gets the resource collection API of EmergingIssues. + * + * @return Resource collection API of EmergingIssues. + */ + public EmergingIssues emergingIssues() { + if (this.emergingIssues == null) { + this.emergingIssues = new EmergingIssuesImpl(clientObject.getEmergingIssues(), this); + } + return emergingIssues; + } + /** * @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 27511c536c39..96dfbc57de3e 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 @@ -41,7 +41,7 @@ public interface AvailabilityStatusesClient { /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -53,7 +53,7 @@ public interface AvailabilityStatusesClient { /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildAvailabilityStatusesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildAvailabilityStatusesClient.java new file mode 100644 index 000000000000..59060cd454f7 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildAvailabilityStatusesClient.java @@ -0,0 +1,82 @@ +// 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.AvailabilityStatusInner; + +/** An instance of this class provides access to all the operations defined in ChildAvailabilityStatusesClient. */ +public interface ChildAvailabilityStatusesClient { + /** + * 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 only support one nesting level resource types : + * /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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context); + + /** + * 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 only support one nesting level resource types : + * /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 current availability status for a single resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilityStatusInner getByResource(String resourceUri); + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, String filter, String expand, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildResourcesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildResourcesClient.java new file mode 100644 index 000000000000..fb3944f7038b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildResourcesClient.java @@ -0,0 +1,48 @@ +// 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.AvailabilityStatusInner; + +/** An instance of this class provides access to all the operations defined in ChildResourcesClient. */ +public interface ChildResourcesClient { + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, String filter, String expand, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EmergingIssuesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EmergingIssuesClient.java new file mode 100644 index 000000000000..bcd4c3732046 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EmergingIssuesClient.java @@ -0,0 +1,63 @@ +// 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.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; + +/** An instance of this class provides access to all the operations defined in EmergingIssuesClient. */ +public interface EmergingIssuesClient { + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(IssueNameParameter issueName, Context context); + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EmergingIssuesGetResultInner get(IssueNameParameter issueName); +} 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..499b13a9f452 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventOperationsClient.java @@ -0,0 +1,128 @@ +// 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 details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 fetchDetailsBySubscriptionIdAndTrackingIdWithResponse(String eventTrackingId, Context context); + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @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 fetchDetailsBySubscriptionIdAndTrackingId(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); + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 fetchDetailsByTenantIdAndTrackingIdWithResponse(String eventTrackingId, Context context); + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @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 fetchDetailsByTenantIdAndTrackingId(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..bb34248f3221 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ImpactedResourcesClient.java @@ -0,0 +1,127 @@ +// 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); + + /** + * Lists impacted resources in the tenant 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 listByTenantIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the tenant 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 listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByTenantIdWithResponse( + String eventTrackingId, String impactedResourceName, Context context); + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventImpactedResourceInner getByTenantId(String eventTrackingId, String impactedResourceName); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MetadatasClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MetadatasClient.java new file mode 100644 index 000000000000..8b047ec2acb4 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MetadatasClient.java @@ -0,0 +1,62 @@ +// 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.MetadataEntityInner; + +/** An instance of this class provides access to all the operations defined in MetadatasClient. */ +public interface MetadatasClient { + /** + * Gets the list of metadata entities. + * + * @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 metadata entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the list of metadata entities. + * + * @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 metadata entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getEntityWithResponse(String name, Context context); + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataEntityInner getEntity(String name); +} 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..34ccd6a7774f 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,60 @@ public interface MicrosoftResourceHealth { * @return the OperationsClient object. */ OperationsClient getOperations(); + + /** + * Gets the MetadatasClient object to access its operations. + * + * @return the MetadatasClient object. + */ + MetadatasClient getMetadatas(); + + /** + * Gets the ImpactedResourcesClient object to access its operations. + * + * @return the ImpactedResourcesClient object. + */ + ImpactedResourcesClient getImpactedResources(); + + /** + * Gets the SecurityAdvisoryImpactedResourcesClient object to access its operations. + * + * @return the SecurityAdvisoryImpactedResourcesClient object. + */ + SecurityAdvisoryImpactedResourcesClient getSecurityAdvisoryImpactedResources(); + + /** + * 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(); + + /** + * Gets the ChildAvailabilityStatusesClient object to access its operations. + * + * @return the ChildAvailabilityStatusesClient object. + */ + ChildAvailabilityStatusesClient getChildAvailabilityStatuses(); + + /** + * Gets the ChildResourcesClient object to access its operations. + * + * @return the ChildResourcesClient object. + */ + ChildResourcesClient getChildResources(); + + /** + * Gets the EmergingIssuesClient object to access its operations. + * + * @return the EmergingIssuesClient object. + */ + EmergingIssuesClient getEmergingIssues(); } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/SecurityAdvisoryImpactedResourcesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/SecurityAdvisoryImpactedResourcesClient.java new file mode 100644 index 000000000000..378f9b237623 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/SecurityAdvisoryImpactedResourcesClient.java @@ -0,0 +1,72 @@ +// 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.EventImpactedResourceInner; + +/** + * An instance of this class provides access to all the operations defined in SecurityAdvisoryImpactedResourcesClient. + */ +public interface SecurityAdvisoryImpactedResourcesClient { + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @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 (Security Advisory). + * + * @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); + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssue.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssue.java new file mode 100644 index 000000000000..a852e16be602 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssue.java @@ -0,0 +1,112 @@ +// 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.StatusActiveEvent; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** On-going emerging issue from azure status. */ +@Fluent +public final class EmergingIssue { + /* + * Timestamp for when last time refreshed for ongoing emerging issue. + */ + @JsonProperty(value = "refreshTimestamp") + private OffsetDateTime refreshTimestamp; + + /* + * The list of emerging issues of banner type. + */ + @JsonProperty(value = "statusBanners") + private List statusBanners; + + /* + * The list of emerging issues of active event type. + */ + @JsonProperty(value = "statusActiveEvents") + private List statusActiveEvents; + + /** Creates an instance of EmergingIssue class. */ + public EmergingIssue() { + } + + /** + * Get the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @return the refreshTimestamp value. + */ + public OffsetDateTime refreshTimestamp() { + return this.refreshTimestamp; + } + + /** + * Set the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @param refreshTimestamp the refreshTimestamp value to set. + * @return the EmergingIssue object itself. + */ + public EmergingIssue withRefreshTimestamp(OffsetDateTime refreshTimestamp) { + this.refreshTimestamp = refreshTimestamp; + return this; + } + + /** + * Get the statusBanners property: The list of emerging issues of banner type. + * + * @return the statusBanners value. + */ + public List statusBanners() { + return this.statusBanners; + } + + /** + * Set the statusBanners property: The list of emerging issues of banner type. + * + * @param statusBanners the statusBanners value to set. + * @return the EmergingIssue object itself. + */ + public EmergingIssue withStatusBanners(List statusBanners) { + this.statusBanners = statusBanners; + return this; + } + + /** + * Get the statusActiveEvents property: The list of emerging issues of active event type. + * + * @return the statusActiveEvents value. + */ + public List statusActiveEvents() { + return this.statusActiveEvents; + } + + /** + * Set the statusActiveEvents property: The list of emerging issues of active event type. + * + * @param statusActiveEvents the statusActiveEvents value to set. + * @return the EmergingIssue object itself. + */ + public EmergingIssue withStatusActiveEvents(List statusActiveEvents) { + this.statusActiveEvents = statusActiveEvents; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statusBanners() != null) { + statusBanners().forEach(e -> e.validate()); + } + if (statusActiveEvents() != null) { + statusActiveEvents().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssuesGetResultInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssuesGetResultInner.java new file mode 100644 index 000000000000..a27d0b9d511a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssuesGetResultInner.java @@ -0,0 +1,132 @@ +// 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.StatusActiveEvent; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The Get EmergingIssues operation response. */ +@Fluent +public final class EmergingIssuesGetResultInner extends ProxyResource { + /* + * The emerging issue entity properties. + */ + @JsonProperty(value = "properties") + private EmergingIssue 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 EmergingIssuesGetResultInner class. */ + public EmergingIssuesGetResultInner() { + } + + /** + * Get the innerProperties property: The emerging issue entity properties. + * + * @return the innerProperties value. + */ + private EmergingIssue 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 refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @return the refreshTimestamp value. + */ + public OffsetDateTime refreshTimestamp() { + return this.innerProperties() == null ? null : this.innerProperties().refreshTimestamp(); + } + + /** + * Set the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @param refreshTimestamp the refreshTimestamp value to set. + * @return the EmergingIssuesGetResultInner object itself. + */ + public EmergingIssuesGetResultInner withRefreshTimestamp(OffsetDateTime refreshTimestamp) { + if (this.innerProperties() == null) { + this.innerProperties = new EmergingIssue(); + } + this.innerProperties().withRefreshTimestamp(refreshTimestamp); + return this; + } + + /** + * Get the statusBanners property: The list of emerging issues of banner type. + * + * @return the statusBanners value. + */ + public List statusBanners() { + return this.innerProperties() == null ? null : this.innerProperties().statusBanners(); + } + + /** + * Set the statusBanners property: The list of emerging issues of banner type. + * + * @param statusBanners the statusBanners value to set. + * @return the EmergingIssuesGetResultInner object itself. + */ + public EmergingIssuesGetResultInner withStatusBanners(List statusBanners) { + if (this.innerProperties() == null) { + this.innerProperties = new EmergingIssue(); + } + this.innerProperties().withStatusBanners(statusBanners); + return this; + } + + /** + * Get the statusActiveEvents property: The list of emerging issues of active event type. + * + * @return the statusActiveEvents value. + */ + public List statusActiveEvents() { + return this.innerProperties() == null ? null : this.innerProperties().statusActiveEvents(); + } + + /** + * Set the statusActiveEvents property: The list of emerging issues of active event type. + * + * @param statusActiveEvents the statusActiveEvents value to set. + * @return the EmergingIssuesGetResultInner object itself. + */ + public EmergingIssuesGetResultInner withStatusActiveEvents(List statusActiveEvents) { + if (this.innerProperties() == null) { + this.innerProperties = new EmergingIssue(); + } + this.innerProperties().withStatusActiveEvents(statusActiveEvents); + 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/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..aac299cc6d69 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventInner.java @@ -0,0 +1,724 @@ +// 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 reason property: The reason for the Incident. + * + * @return the reason value. + */ + public String reason() { + return this.innerProperties() == null ? null : this.innerProperties().reason(); + } + + /** + * Set the reason property: The reason for the Incident. + * + * @param reason the reason value to set. + * @return the EventInner object itself. + */ + public EventInner withReason(String reason) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withReason(reason); + 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..ff31364f2f3a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventProperties.java @@ -0,0 +1,793 @@ +// 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; + + /* + * The reason for the Incident + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * 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 reason property: The reason for the Incident. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the Incident. + * + * @param reason the reason value to set. + * @return the EventProperties object itself. + */ + public EventProperties withReason(String reason) { + this.reason = reason; + 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/MetadataEntityInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityInner.java new file mode 100644 index 000000000000..e21596fda4ee --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityInner.java @@ -0,0 +1,154 @@ +// 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.MetadataSupportedValueDetail; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The metadata entity contract. */ +@Fluent +public final class MetadataEntityInner extends ProxyResource { + /* + * The metadata entity properties. + */ + @JsonProperty(value = "properties") + private MetadataEntityProperties 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 MetadataEntityInner class. */ + public MetadataEntityInner() { + } + + /** + * Get the innerProperties property: The metadata entity properties. + * + * @return the innerProperties value. + */ + private MetadataEntityProperties 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 displayName property: The display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name. + * + * @param displayName the displayName value to set. + * @return the MetadataEntityInner object itself. + */ + public MetadataEntityInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataEntityProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the dependsOn property: The list of keys on which this entity depends on. + * + * @return the dependsOn value. + */ + public List dependsOn() { + return this.innerProperties() == null ? null : this.innerProperties().dependsOn(); + } + + /** + * Set the dependsOn property: The list of keys on which this entity depends on. + * + * @param dependsOn the dependsOn value to set. + * @return the MetadataEntityInner object itself. + */ + public MetadataEntityInner withDependsOn(List dependsOn) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataEntityProperties(); + } + this.innerProperties().withDependsOn(dependsOn); + return this; + } + + /** + * Get the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @return the applicableScenarios value. + */ + public List applicableScenarios() { + return this.innerProperties() == null ? null : this.innerProperties().applicableScenarios(); + } + + /** + * Set the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @param applicableScenarios the applicableScenarios value to set. + * @return the MetadataEntityInner object itself. + */ + public MetadataEntityInner withApplicableScenarios(List applicableScenarios) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataEntityProperties(); + } + this.innerProperties().withApplicableScenarios(applicableScenarios); + return this; + } + + /** + * Get the supportedValues property: The list of supported values. + * + * @return the supportedValues value. + */ + public List supportedValues() { + return this.innerProperties() == null ? null : this.innerProperties().supportedValues(); + } + + /** + * Set the supportedValues property: The list of supported values. + * + * @param supportedValues the supportedValues value to set. + * @return the MetadataEntityInner object itself. + */ + public MetadataEntityInner withSupportedValues(List supportedValues) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataEntityProperties(); + } + this.innerProperties().withSupportedValues(supportedValues); + 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/MetadataEntityProperties.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityProperties.java new file mode 100644 index 000000000000..37af7118aae0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityProperties.java @@ -0,0 +1,134 @@ +// 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.MetadataSupportedValueDetail; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The metadata entity properties. */ +@Fluent +public final class MetadataEntityProperties { + /* + * The display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The list of keys on which this entity depends on. + */ + @JsonProperty(value = "dependsOn") + private List dependsOn; + + /* + * The list of scenarios applicable to this metadata entity. + */ + @JsonProperty(value = "applicableScenarios") + private List applicableScenarios; + + /* + * The list of supported values. + */ + @JsonProperty(value = "supportedValues") + private List supportedValues; + + /** Creates an instance of MetadataEntityProperties class. */ + public MetadataEntityProperties() { + } + + /** + * Get the displayName property: The display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name. + * + * @param displayName the displayName value to set. + * @return the MetadataEntityProperties object itself. + */ + public MetadataEntityProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the dependsOn property: The list of keys on which this entity depends on. + * + * @return the dependsOn value. + */ + public List dependsOn() { + return this.dependsOn; + } + + /** + * Set the dependsOn property: The list of keys on which this entity depends on. + * + * @param dependsOn the dependsOn value to set. + * @return the MetadataEntityProperties object itself. + */ + public MetadataEntityProperties withDependsOn(List dependsOn) { + this.dependsOn = dependsOn; + return this; + } + + /** + * Get the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @return the applicableScenarios value. + */ + public List applicableScenarios() { + return this.applicableScenarios; + } + + /** + * Set the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @param applicableScenarios the applicableScenarios value to set. + * @return the MetadataEntityProperties object itself. + */ + public MetadataEntityProperties withApplicableScenarios(List applicableScenarios) { + this.applicableScenarios = applicableScenarios; + return this; + } + + /** + * Get the supportedValues property: The list of supported values. + * + * @return the supportedValues value. + */ + public List supportedValues() { + return this.supportedValues; + } + + /** + * Set the supportedValues property: The list of supported values. + * + * @param supportedValues the supportedValues value to set. + * @return the MetadataEntityProperties object itself. + */ + public MetadataEntityProperties withSupportedValues(List supportedValues) { + this.supportedValues = supportedValues; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedValues() != null) { + supportedValues().forEach(e -> e.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 2c78b0dd5792..71702715a081 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 @@ -14,7 +14,7 @@ @Fluent public final class OperationListResultInner { /* - * List of operations available in the resourcehealth resource provider. + * List of operations available in the Microsoft.ResourceHealth resource provider. */ @JsonProperty(value = "value", required = true) private List value; @@ -24,7 +24,7 @@ public OperationListResultInner() { } /** - * Get the value property: List of operations available in the resourcehealth resource provider. + * Get the value property: List of operations available in the Microsoft.ResourceHealth resource provider. * * @return the value value. */ @@ -33,7 +33,7 @@ public List value() { } /** - * Set the value property: List of operations available in the resourcehealth resource provider. + * Set the value property: List of operations available in the Microsoft.ResourceHealth resource provider. * * @param value the value value to set. * @return the OperationListResultInner object itself. 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 c38c1031fd67..b5e914a561fe 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 @@ -72,8 +72,7 @@ Mono> listBySubscriptionId( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth" - + "/availabilityStatuses") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @@ -333,7 +332,7 @@ public PagedIterable listBySubscriptionId(String filter /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -391,7 +390,7 @@ private Mono> listByResourceGroupSinglePa /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -447,7 +446,7 @@ private Mono> listByResourceGroupSinglePa /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -467,7 +466,7 @@ private PagedFlux listByResourceGroupAsync( /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -485,7 +484,7 @@ private PagedFlux listByResourceGroupAsync(String resou /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -506,7 +505,7 @@ private PagedFlux listByResourceGroupAsync( /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -522,7 +521,7 @@ public PagedIterable listByResourceGroup(String resourc /** * Lists the current availability status for all the resources in the resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesClientImpl.java new file mode 100644 index 000000000000..1c7a14bd4b82 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesClientImpl.java @@ -0,0 +1,511 @@ +// 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.ChildAvailabilityStatusesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ChildAvailabilityStatusesClient. */ +public final class ChildAvailabilityStatusesClientImpl implements ChildAvailabilityStatusesClient { + /** The proxy service used to perform REST calls. */ + private final ChildAvailabilityStatusesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of ChildAvailabilityStatusesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChildAvailabilityStatusesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy + .create( + ChildAvailabilityStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthChildAvailabilityStatuses to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface ChildAvailabilityStatusesService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 only support one nesting level resource types : + * /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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceWithResponseAsync( + String resourceUri, String filter, String expand) { + 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 + .getByResource( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + filter, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 only support one nesting level resource types : + * /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} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceWithResponseAsync( + String resourceUri, String filter, String expand, 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 + .getByResource( + this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), filter, expand, accept, context); + } + + /** + * 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 only support one nesting level resource types : + * /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 current availability status for a single resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceAsync(String resourceUri) { + final String filter = null; + final String expand = null; + return getByResourceWithResponseAsync(resourceUri, filter, expand) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 only support one nesting level resource types : + * /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(); + } + + /** + * 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 only support one nesting level resource types : + * /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 current availability status for a single resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilityStatusInner getByResource(String resourceUri) { + final String filter = null; + final String expand = null; + return getByResourceWithResponse(resourceUri, filter, expand, Context.NONE).getValue(); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String filter, String expand) { + 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 + .list( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + filter, + expand, + 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 the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String filter, String expand, 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 + .list(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), filter, expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, String filter, String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final String filter = null; + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, String filter, String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final String filter = null; + final String expand = null; + return new PagedIterable<>(listAsync(resourceUri, filter, expand)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceUri, String filter, String expand, Context context) { + return new PagedIterable<>(listAsync(resourceUri, filter, expand, 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 availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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 + .listNext(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/ChildAvailabilityStatusesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesImpl.java new file mode 100644 index 000000000000..6291c177321e --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesImpl.java @@ -0,0 +1,72 @@ +// 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.ChildAvailabilityStatusesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; +import com.azure.resourcemanager.resourcehealth.models.ChildAvailabilityStatuses; + +public final class ChildAvailabilityStatusesImpl implements ChildAvailabilityStatuses { + private static final ClientLogger LOGGER = new ClientLogger(ChildAvailabilityStatusesImpl.class); + + private final ChildAvailabilityStatusesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public ChildAvailabilityStatusesImpl( + ChildAvailabilityStatusesClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context) { + Response inner = + this.serviceClient().getByResourceWithResponse(resourceUri, filter, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AvailabilityStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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())); + } + + public PagedIterable list(String resourceUri, String filter, String expand, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, filter, expand, context); + return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); + } + + private ChildAvailabilityStatusesClient 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/ChildResourcesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesClientImpl.java new file mode 100644 index 000000000000..e58dbdbb60ba --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesClientImpl.java @@ -0,0 +1,360 @@ +// 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.ChildResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ChildResourcesClient. */ +public final class ChildResourcesClientImpl implements ChildResourcesClient { + /** The proxy service used to perform REST calls. */ + private final ChildResourcesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of ChildResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChildResourcesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(ChildResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthChildResources to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface ChildResourcesService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ResourceHealth/childResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String filter, String expand) { + 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 + .list( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + filter, + expand, + 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 the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String filter, String expand, 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 + .list(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), filter, expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, String filter, String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final String filter = null; + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, String filter, String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final String filter = null; + final String expand = null; + return new PagedIterable<>(listAsync(resourceUri, filter, expand)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceUri, String filter, String expand, Context context) { + return new PagedIterable<>(listAsync(resourceUri, filter, expand, 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 availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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 + .listNext(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/ChildResourcesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesImpl.java new file mode 100644 index 000000000000..2f7ed118d0c5 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesImpl.java @@ -0,0 +1,46 @@ +// 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.ChildResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; +import com.azure.resourcemanager.resourcehealth.models.ChildResources; + +public final class ChildResourcesImpl implements ChildResources { + private static final ClientLogger LOGGER = new ClientLogger(ChildResourcesImpl.class); + + private final ChildResourcesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public ChildResourcesImpl( + ChildResourcesClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, String filter, String expand, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, filter, expand, context); + return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); + } + + private ChildResourcesClient 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/EmergingIssuesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesClientImpl.java new file mode 100644 index 000000000000..38b9fa4b4391 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesClientImpl.java @@ -0,0 +1,379 @@ +// 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.EmergingIssuesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssueListResult; +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EmergingIssuesClient. */ +public final class EmergingIssuesClientImpl implements EmergingIssuesClient { + /** The proxy service used to perform REST calls. */ + private final EmergingIssuesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of EmergingIssuesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EmergingIssuesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(EmergingIssuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthEmergingIssues to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface EmergingIssuesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/emergingIssues") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("issueName") IssueNameParameter issueName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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.list(this.client.getEndpoint(), this.client.getApiVersion(), 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 Azure services' emerging issues. + * + * @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 emerging issues along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(IssueNameParameter issueName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (issueName == null) { + return Mono.error(new IllegalArgumentException("Parameter issueName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), issueName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + IssueNameParameter issueName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (issueName == null) { + return Mono.error(new IllegalArgumentException("Parameter issueName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), issueName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(IssueNameParameter issueName) { + return getWithResponseAsync(issueName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(IssueNameParameter issueName, Context context) { + return getWithResponseAsync(issueName, context).block(); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EmergingIssuesGetResultInner get(IssueNameParameter issueName) { + return getWithResponse(issueName, 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 emerging issues along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 emerging issues along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + 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 + .listNext(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/EmergingIssuesGetResultImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesGetResultImpl.java new file mode 100644 index 000000000000..a72dc6153694 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesGetResultImpl.java @@ -0,0 +1,73 @@ +// 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.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssuesGetResult; +import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class EmergingIssuesGetResultImpl implements EmergingIssuesGetResult { + private EmergingIssuesGetResultInner innerObject; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + EmergingIssuesGetResultImpl( + EmergingIssuesGetResultInner 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 OffsetDateTime refreshTimestamp() { + return this.innerModel().refreshTimestamp(); + } + + public List statusBanners() { + List inner = this.innerModel().statusBanners(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List statusActiveEvents() { + List inner = this.innerModel().statusActiveEvents(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EmergingIssuesGetResultInner 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/EmergingIssuesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesImpl.java new file mode 100644 index 000000000000..f1e6458d47a6 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesImpl.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.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.EmergingIssuesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssues; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssuesGetResult; +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; + +public final class EmergingIssuesImpl implements EmergingIssues { + private static final ClientLogger LOGGER = new ClientLogger(EmergingIssuesImpl.class); + + private final EmergingIssuesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public EmergingIssuesImpl( + EmergingIssuesClient 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 EmergingIssuesGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new EmergingIssuesGetResultImpl(inner1, this.manager())); + } + + public Response getWithResponse(IssueNameParameter issueName, Context context) { + Response inner = this.serviceClient().getWithResponse(issueName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EmergingIssuesGetResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EmergingIssuesGetResult get(IssueNameParameter issueName) { + EmergingIssuesGetResultInner inner = this.serviceClient().get(issueName); + if (inner != null) { + return new EmergingIssuesGetResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private EmergingIssuesClient 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/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..01b3c0c02481 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpl.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.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 String reason() { + return this.innerModel().reason(); + } + + 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..017b2d09932e --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsClientImpl.java @@ -0,0 +1,637 @@ +// 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.Post; +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"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> fetchDetailsBySubscriptionIdAndTrackingId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @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); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> fetchDetailsByTenantIdAndTrackingId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @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 details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> fetchDetailsBySubscriptionIdAndTrackingIdWithResponseAsync( + String eventTrackingId) { + 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 + .fetchDetailsBySubscriptionIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + eventTrackingId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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> fetchDetailsBySubscriptionIdAndTrackingIdWithResponseAsync( + String eventTrackingId, 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 + .fetchDetailsBySubscriptionIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + eventTrackingId, + accept, + context); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @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 fetchDetailsBySubscriptionIdAndTrackingIdAsync(String eventTrackingId) { + return fetchDetailsBySubscriptionIdAndTrackingIdWithResponseAsync(eventTrackingId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 fetchDetailsBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, Context context) { + return fetchDetailsBySubscriptionIdAndTrackingIdWithResponseAsync(eventTrackingId, context).block(); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @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 fetchDetailsBySubscriptionIdAndTrackingId(String eventTrackingId) { + return fetchDetailsBySubscriptionIdAndTrackingIdWithResponse(eventTrackingId, 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(); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> fetchDetailsByTenantIdAndTrackingIdWithResponseAsync(String eventTrackingId) { + 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 + .fetchDetailsByTenantIdAndTrackingId( + this.client.getEndpoint(), this.client.getApiVersion(), eventTrackingId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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> fetchDetailsByTenantIdAndTrackingIdWithResponseAsync( + String eventTrackingId, 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 + .fetchDetailsByTenantIdAndTrackingId( + this.client.getEndpoint(), this.client.getApiVersion(), eventTrackingId, accept, context); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @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 fetchDetailsByTenantIdAndTrackingIdAsync(String eventTrackingId) { + return fetchDetailsByTenantIdAndTrackingIdWithResponseAsync(eventTrackingId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 fetchDetailsByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, Context context) { + return fetchDetailsByTenantIdAndTrackingIdWithResponseAsync(eventTrackingId, context).block(); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @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 fetchDetailsByTenantIdAndTrackingId(String eventTrackingId) { + return fetchDetailsByTenantIdAndTrackingIdWithResponse(eventTrackingId, 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..a381bbb2838a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsImpl.java @@ -0,0 +1,136 @@ +// 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 fetchDetailsBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, Context context) { + Response inner = + this.serviceClient().fetchDetailsBySubscriptionIdAndTrackingIdWithResponse(eventTrackingId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Event fetchDetailsBySubscriptionIdAndTrackingId(String eventTrackingId) { + EventInner inner = this.serviceClient().fetchDetailsBySubscriptionIdAndTrackingId(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; + } + } + + public Response fetchDetailsByTenantIdAndTrackingIdWithResponse(String eventTrackingId, Context context) { + Response inner = + this.serviceClient().fetchDetailsByTenantIdAndTrackingIdWithResponse(eventTrackingId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Event fetchDetailsByTenantIdAndTrackingId(String eventTrackingId) { + EventInner inner = this.serviceClient().fetchDetailsByTenantIdAndTrackingId(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..e03343120cf9 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesClientImpl.java @@ -0,0 +1,944 @@ +// 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("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdAndEventId( + @HostParam("$host") String endpoint, + @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("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByTenantId( + @HostParam("$host") String endpoint, + @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); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdAndEventIdNext( + @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(); + } + + /** + * Lists impacted resources in the tenant 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> listByTenantIdAndEventIdSinglePageAsync( + 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 (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 + .listByTenantIdAndEventId( + this.client.getEndpoint(), + 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 tenant 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> listByTenantIdAndEventIdSinglePageAsync( + 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 (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 + .listByTenantIdAndEventId( + this.client.getEndpoint(), 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 tenant 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 listByTenantIdAndEventIdAsync(String eventTrackingId, String filter) { + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the tenant 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 listByTenantIdAndEventIdAsync(String eventTrackingId) { + final String filter = null; + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the tenant 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 listByTenantIdAndEventIdAsync( + String eventTrackingId, String filter, Context context) { + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter, context), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists impacted resources in the tenant 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 listByTenantIdAndEventId(String eventTrackingId) { + final String filter = null; + return new PagedIterable<>(listByTenantIdAndEventIdAsync(eventTrackingId, filter)); + } + + /** + * Lists impacted resources in the tenant 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 listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context) { + return new PagedIterable<>(listByTenantIdAndEventIdAsync(eventTrackingId, filter, context)); + } + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByTenantIdWithResponseAsync( + 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 (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 + .getByTenantId( + this.client.getEndpoint(), + eventTrackingId, + impactedResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByTenantIdWithResponseAsync( + 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 (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 + .getByTenantId( + this.client.getEndpoint(), + eventTrackingId, + impactedResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByTenantIdAsync(String eventTrackingId, String impactedResourceName) { + return getByTenantIdWithResponseAsync(eventTrackingId, impactedResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByTenantIdWithResponse( + String eventTrackingId, String impactedResourceName, Context context) { + return getByTenantIdWithResponseAsync(eventTrackingId, impactedResourceName, context).block(); + } + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventImpactedResourceInner getByTenantId(String eventTrackingId, String impactedResourceName) { + return getByTenantIdWithResponse(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)); + } + + /** + * 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> listByTenantIdAndEventIdNextSinglePageAsync( + 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.listByTenantIdAndEventIdNext(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> listByTenantIdAndEventIdNextSinglePageAsync( + 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 + .listByTenantIdAndEventIdNext(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..69920bd10a29 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesImpl.java @@ -0,0 +1,112 @@ +// 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; + } + } + + public PagedIterable listByTenantIdAndEventId(String eventTrackingId) { + PagedIterable inner = + this.serviceClient().listByTenantIdAndEventId(eventTrackingId); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByTenantIdAndEventId(eventTrackingId, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public Response getByTenantIdWithResponse( + String eventTrackingId, String impactedResourceName, Context context) { + Response inner = + this.serviceClient().getByTenantIdWithResponse(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 getByTenantId(String eventTrackingId, String impactedResourceName) { + EventImpactedResourceInner inner = this.serviceClient().getByTenantId(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/MetadataEntityImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadataEntityImpl.java new file mode 100644 index 000000000000..d0627220448c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadataEntityImpl.java @@ -0,0 +1,81 @@ +// 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.MetadataEntityInner; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntity; +import com.azure.resourcemanager.resourcehealth.models.MetadataSupportedValueDetail; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import java.util.Collections; +import java.util.List; + +public final class MetadataEntityImpl implements MetadataEntity { + private MetadataEntityInner innerObject; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + MetadataEntityImpl( + MetadataEntityInner 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 displayName() { + return this.innerModel().displayName(); + } + + public List dependsOn() { + List inner = this.innerModel().dependsOn(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List applicableScenarios() { + List inner = this.innerModel().applicableScenarios(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List supportedValues() { + List inner = this.innerModel().supportedValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetadataEntityInner 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/MetadatasClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasClientImpl.java new file mode 100644 index 000000000000..3d1f6e56c500 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasClientImpl.java @@ -0,0 +1,376 @@ +// 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.MetadatasClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntityListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MetadatasClient. */ +public final class MetadatasClientImpl implements MetadatasClient { + /** The proxy service used to perform REST calls. */ + private final MetadatasService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of MetadatasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetadatasClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(MetadatasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthMetadatas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface MetadatasService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/metadata") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/metadata/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getEntity( + @HostParam("$host") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the list of metadata entities. + * + * @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 metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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.list(this.client.getEndpoint(), this.client.getApiVersion(), 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())); + } + + /** + * Gets the list of metadata entities. + * + * @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 metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of metadata entities. + * + * @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 metadata entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of metadata entities. + * + * @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 metadata entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of metadata entities. + * + * @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 metadata entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the list of metadata entities. + * + * @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 metadata entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEntityWithResponseAsync(String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.getEntity(this.client.getEndpoint(), name, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEntityWithResponseAsync(String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getEntity(this.client.getEndpoint(), name, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getEntityAsync(String name) { + return getEntityWithResponseAsync(name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEntityWithResponse(String name, Context context) { + return getEntityWithResponseAsync(name, context).block(); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataEntityInner getEntity(String name) { + return getEntityWithResponse(name, 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 metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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 + .listNext(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/MetadatasImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasImpl.java new file mode 100644 index 000000000000..05b14251f38c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasImpl.java @@ -0,0 +1,69 @@ +// 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.MetadatasClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntity; +import com.azure.resourcemanager.resourcehealth.models.Metadatas; + +public final class MetadatasImpl implements Metadatas { + private static final ClientLogger LOGGER = new ClientLogger(MetadatasImpl.class); + + private final MetadatasClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public MetadatasImpl( + MetadatasClient 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 MetadataEntityImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new MetadataEntityImpl(inner1, this.manager())); + } + + public Response getEntityWithResponse(String name, Context context) { + Response inner = this.serviceClient().getEntityWithResponse(name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetadataEntityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetadataEntity getEntity(String name) { + MetadataEntityInner inner = this.serviceClient().getEntity(name); + if (inner != null) { + return new MetadataEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + private MetadatasClient 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 2227b2982d87..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 @@ -18,14 +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. 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 7574172bf6cd..bdef7bdfa60d 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 @@ -23,8 +23,16 @@ 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.ChildAvailabilityStatusesClient; +import com.azure.resourcemanager.resourcehealth.fluent.ChildResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.EmergingIssuesClient; +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.MetadatasClient; import com.azure.resourcemanager.resourcehealth.fluent.MicrosoftResourceHealth; import com.azure.resourcemanager.resourcehealth.fluent.OperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.SecurityAdvisoryImpactedResourcesClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -37,15 +45,11 @@ /** 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 +141,102 @@ public OperationsClient getOperations() { return this.operations; } + /** The MetadatasClient object to access its operations. */ + private final MetadatasClient metadatas; + + /** + * Gets the MetadatasClient object to access its operations. + * + * @return the MetadatasClient object. + */ + public MetadatasClient getMetadatas() { + return this.metadatas; + } + + /** 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 SecurityAdvisoryImpactedResourcesClient object to access its operations. */ + private final SecurityAdvisoryImpactedResourcesClient securityAdvisoryImpactedResources; + + /** + * Gets the SecurityAdvisoryImpactedResourcesClient object to access its operations. + * + * @return the SecurityAdvisoryImpactedResourcesClient object. + */ + public SecurityAdvisoryImpactedResourcesClient getSecurityAdvisoryImpactedResources() { + return this.securityAdvisoryImpactedResources; + } + + /** 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; + } + + /** The ChildAvailabilityStatusesClient object to access its operations. */ + private final ChildAvailabilityStatusesClient childAvailabilityStatuses; + + /** + * Gets the ChildAvailabilityStatusesClient object to access its operations. + * + * @return the ChildAvailabilityStatusesClient object. + */ + public ChildAvailabilityStatusesClient getChildAvailabilityStatuses() { + return this.childAvailabilityStatuses; + } + + /** The ChildResourcesClient object to access its operations. */ + private final ChildResourcesClient childResources; + + /** + * Gets the ChildResourcesClient object to access its operations. + * + * @return the ChildResourcesClient object. + */ + public ChildResourcesClient getChildResources() { + return this.childResources; + } + + /** The EmergingIssuesClient object to access its operations. */ + private final EmergingIssuesClient emergingIssues; + + /** + * Gets the EmergingIssuesClient object to access its operations. + * + * @return the EmergingIssuesClient object. + */ + public EmergingIssuesClient getEmergingIssues() { + return this.emergingIssues; + } + /** * Initializes an instance of MicrosoftResourceHealth client. * @@ -144,8 +244,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 +259,17 @@ public OperationsClient getOperations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2020-05-01"; + this.apiVersion = "2022-10-01"; this.availabilityStatuses = new AvailabilityStatusesClientImpl(this); this.operations = new OperationsClientImpl(this); + this.metadatas = new MetadatasClientImpl(this); + this.impactedResources = new ImpactedResourcesClientImpl(this); + this.securityAdvisoryImpactedResources = new SecurityAdvisoryImpactedResourcesClientImpl(this); + this.eventsOperations = new EventsOperationsClientImpl(this); + this.eventOperations = new EventOperationsClientImpl(this); + this.childAvailabilityStatuses = new ChildAvailabilityStatusesClientImpl(this); + this.childResources = new ChildResourcesClientImpl(this); + this.emergingIssues = new EmergingIssuesClientImpl(this); } /** diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesClientImpl.java new file mode 100644 index 000000000000..e3120085004b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesClientImpl.java @@ -0,0 +1,647 @@ +// 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.Post; +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.SecurityAdvisoryImpactedResourcesClient; +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 SecurityAdvisoryImpactedResourcesClient. + */ +public final class SecurityAdvisoryImpactedResourcesClientImpl implements SecurityAdvisoryImpactedResourcesClient { + /** The proxy service used to perform REST calls. */ + private final SecurityAdvisoryImpactedResourcesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of SecurityAdvisoryImpactedResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityAdvisoryImpactedResourcesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy + .create( + SecurityAdvisoryImpactedResourcesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthSecurityAdvisoryImpactedResources to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface SecurityAdvisoryImpactedResourcesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources") + @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"}) + @Post("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdAndEventId( + @HostParam("$host") String endpoint, + @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("{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); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdAndEventIdNext( + @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 (Security Advisory). + * + * @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 (Security Advisory). + * + * @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 (Security Advisory). + * + * @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 (Security Advisory). + * + * @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 (Security Advisory). + * + * @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 (Security Advisory). + * + * @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 (Security Advisory). + * + * @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)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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> listByTenantIdAndEventIdSinglePageAsync( + 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 (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 + .listByTenantIdAndEventId( + this.client.getEndpoint(), + 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 tenant by an event (Security Advisory). + * + * @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> listByTenantIdAndEventIdSinglePageAsync( + 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 (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 + .listByTenantIdAndEventId( + this.client.getEndpoint(), 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 tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventIdAsync(String eventTrackingId, String filter) { + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventIdAsync(String eventTrackingId) { + final String filter = null; + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventIdAsync( + String eventTrackingId, String filter, Context context) { + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter, context), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventId(String eventTrackingId) { + final String filter = null; + return new PagedIterable<>(listByTenantIdAndEventIdAsync(eventTrackingId, filter)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context) { + return new PagedIterable<>(listByTenantIdAndEventIdAsync(eventTrackingId, 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 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)); + } + + /** + * 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> listByTenantIdAndEventIdNextSinglePageAsync( + 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.listByTenantIdAndEventIdNext(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> listByTenantIdAndEventIdNextSinglePageAsync( + 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 + .listByTenantIdAndEventIdNext(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/SecurityAdvisoryImpactedResourcesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesImpl.java new file mode 100644 index 000000000000..13c2f1fec7f3 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesImpl.java @@ -0,0 +1,62 @@ +// 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.SecurityAdvisoryImpactedResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import com.azure.resourcemanager.resourcehealth.models.SecurityAdvisoryImpactedResources; + +public final class SecurityAdvisoryImpactedResourcesImpl implements SecurityAdvisoryImpactedResources { + private static final ClientLogger LOGGER = new ClientLogger(SecurityAdvisoryImpactedResourcesImpl.class); + + private final SecurityAdvisoryImpactedResourcesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public SecurityAdvisoryImpactedResourcesImpl( + SecurityAdvisoryImpactedResourcesClient 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 PagedIterable listByTenantIdAndEventId(String eventTrackingId) { + PagedIterable inner = + this.serviceClient().listByTenantIdAndEventId(eventTrackingId); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByTenantIdAndEventId(eventTrackingId, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + private SecurityAdvisoryImpactedResourcesClient 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/models/AvailabilityStateValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/AvailabilityStateValues.java index b0d85a46fadb..d17c16a3f28e 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 @@ -22,6 +22,15 @@ public final class AvailabilityStateValues extends ExpandableStringEnum getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context); + + /** + * 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 only support one nesting level resource types : + * /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 current availability status for a single resource. + */ + AvailabilityStatus getByResource(String resourceUri); + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /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 the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, String filter, String expand, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildResources.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildResources.java new file mode 100644 index 000000000000..3f350225c5ca --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildResources.java @@ -0,0 +1,43 @@ +// 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 ChildResources. */ +public interface ChildResources { + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @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 the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, String filter, String expand, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueImpact.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueImpact.java new file mode 100644 index 000000000000..c5c26313b29a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueImpact.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; + +/** Object of the emerging issue impact on services and regions. */ +@Fluent +public final class EmergingIssueImpact { + /* + * The impacted service id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The impacted service name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The list of impacted regions for corresponding emerging issues. + */ + @JsonProperty(value = "regions") + private List regions; + + /** Creates an instance of EmergingIssueImpact class. */ + public EmergingIssueImpact() { + } + + /** + * Get the id property: The impacted service id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The impacted service id. + * + * @param id the id value to set. + * @return the EmergingIssueImpact object itself. + */ + public EmergingIssueImpact withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The impacted service name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The impacted service name. + * + * @param name the name value to set. + * @return the EmergingIssueImpact object itself. + */ + public EmergingIssueImpact withName(String name) { + this.name = name; + return this; + } + + /** + * Get the regions property: The list of impacted regions for corresponding emerging issues. + * + * @return the regions value. + */ + public List regions() { + return this.regions; + } + + /** + * Set the regions property: The list of impacted regions for corresponding emerging issues. + * + * @param regions the regions value to set. + * @return the EmergingIssueImpact object itself. + */ + public EmergingIssueImpact withRegions(List regions) { + this.regions = regions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (regions() != null) { + regions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueListResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueListResult.java new file mode 100644 index 000000000000..9922320551a0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueListResult.java @@ -0,0 +1,81 @@ +// 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.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of emerging issues. */ +@Fluent +public final class EmergingIssueListResult { + /* + * The list of emerging issues. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of emerging issues. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of EmergingIssueListResult class. */ + public EmergingIssueListResult() { + } + + /** + * Get the value property: The list of emerging issues. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of emerging issues. + * + * @param value the value value to set. + * @return the EmergingIssueListResult object itself. + */ + public EmergingIssueListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of emerging issues. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of emerging issues. + * + * @param nextLink the nextLink value to set. + * @return the EmergingIssueListResult object itself. + */ + public EmergingIssueListResult 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) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssues.java new file mode 100644 index 000000000000..e4f75aef3edc --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssues.java @@ -0,0 +1,55 @@ +// 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 EmergingIssues. */ +public interface EmergingIssues { + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists Azure services' emerging issues. + * + * @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 emerging issues as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues along with {@link Response}. + */ + Response getWithResponse(IssueNameParameter issueName, Context context); + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues. + */ + EmergingIssuesGetResult get(IssueNameParameter issueName); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssuesGetResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssuesGetResult.java new file mode 100644 index 000000000000..90239235eb33 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssuesGetResult.java @@ -0,0 +1,69 @@ +// 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.EmergingIssuesGetResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of EmergingIssuesGetResult. */ +public interface EmergingIssuesGetResult { + /** + * 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 refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @return the refreshTimestamp value. + */ + OffsetDateTime refreshTimestamp(); + + /** + * Gets the statusBanners property: The list of emerging issues of banner type. + * + * @return the statusBanners value. + */ + List statusBanners(); + + /** + * Gets the statusActiveEvents property: The list of emerging issues of active event type. + * + * @return the statusActiveEvents value. + */ + List statusActiveEvents(); + + /** + * Gets the inner com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner object. + * + * @return the inner object. + */ + EmergingIssuesGetResultInner innerModel(); +} 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..04289b9b2d5f --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Event.java @@ -0,0 +1,248 @@ +// 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 reason property: The reason for the Incident. + * + * @return the reason value. + */ + String reason(); + + /** + * 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..f593bd0f815b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventLevelValues.java @@ -0,0 +1,53 @@ +// 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 a new instance of EventLevelValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventLevelValues() { + } + + /** + * 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..369e787c7103 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventOperations.java @@ -0,0 +1,117 @@ +// 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 details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 fetchDetailsBySubscriptionIdAndTrackingIdWithResponse(String eventTrackingId, Context context); + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @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 fetchDetailsBySubscriptionIdAndTrackingId(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); + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 fetchDetailsByTenantIdAndTrackingIdWithResponse(String eventTrackingId, Context context); + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @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 fetchDetailsByTenantIdAndTrackingId(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..e728964eb8d0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesArticle.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; + +/** Article of event. */ +@Fluent +public final class EventPropertiesArticle { + /* + * Article content of event. + */ + @JsonProperty(value = "articleContent") + private String articleContent; + + /* + * Article Id + */ + @JsonProperty(value = "articleId") + private String articleId; + + /* + * It provides a map of parameter name and value + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** 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; + } + + /** + * Get the articleId property: Article Id. + * + * @return the articleId value. + */ + public String articleId() { + return this.articleId; + } + + /** + * Set the articleId property: Article Id. + * + * @param articleId the articleId value to set. + * @return the EventPropertiesArticle object itself. + */ + public EventPropertiesArticle withArticleId(String articleId) { + this.articleId = articleId; + return this; + } + + /** + * Get the parameters property: It provides a map of parameter name and value. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: It provides a map of parameter name and value. + * + * @param parameters the parameters value to set. + * @return the EventPropertiesArticle object itself. + */ + public EventPropertiesArticle withParameters(Object parameters) { + this.parameters = parameters; + 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..fb20dfd88f91 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventSourceValues.java @@ -0,0 +1,47 @@ +// 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 a new instance of EventSourceValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventSourceValues() { + } + + /** + * 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..a9cf2aba9cea --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventStatusValues.java @@ -0,0 +1,47 @@ +// 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 a new instance of EventStatusValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventStatusValues() { + } + + /** + * 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..bead23ec5642 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventTypeValues.java @@ -0,0 +1,59 @@ +// 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 a new instance of EventTypeValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventTypeValues() { + } + + /** + * 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/ImpactedRegion.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedRegion.java new file mode 100644 index 000000000000..18435366560f --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedRegion.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; + +/** Object of impacted region. */ +@Fluent +public final class ImpactedRegion { + /* + * The impacted region id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The impacted region name. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of ImpactedRegion class. */ + public ImpactedRegion() { + } + + /** + * Get the id property: The impacted region id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The impacted region id. + * + * @param id the id value to set. + * @return the ImpactedRegion object itself. + */ + public ImpactedRegion withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The impacted region name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The impacted region name. + * + * @param name the name value to set. + * @return the ImpactedRegion object itself. + */ + public ImpactedRegion withName(String name) { + this.name = name; + 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/ImpactedResources.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java new file mode 100644 index 000000000000..e7cc441f2c7a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java @@ -0,0 +1,116 @@ +// 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); + + /** + * Lists impacted resources in the tenant 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 listByTenantIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the tenant 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 listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event along with {@link Response}. + */ + Response getByTenantIdWithResponse( + String eventTrackingId, String impactedResourceName, Context context); + + /** + * Gets the specific impacted resource in the tenant 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 tenant by an event. + */ + EventImpactedResource getByTenantId(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/IssueNameParameter.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/IssueNameParameter.java new file mode 100644 index 000000000000..439b42f18acd --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/IssueNameParameter.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; + +/** Defines values for IssueNameParameter. */ +public final class IssueNameParameter extends ExpandableStringEnum { + /** Static value default for IssueNameParameter. */ + public static final IssueNameParameter DEFAULT = fromString("default"); + + /** + * Creates a new instance of IssueNameParameter value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IssueNameParameter() { + } + + /** + * Creates or finds a IssueNameParameter from its string representation. + * + * @param name a name to look for. + * @return the corresponding IssueNameParameter. + */ + @JsonCreator + public static IssueNameParameter fromString(String name) { + return fromString(name, IssueNameParameter.class); + } + + /** + * Gets known IssueNameParameter values. + * + * @return known IssueNameParameter values. + */ + public static Collection values() { + return values(IssueNameParameter.class); + } +} 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..54fe25745149 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LevelValues.java @@ -0,0 +1,47 @@ +// 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 a new instance of LevelValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LevelValues() { + } + + /** + * 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..3629b35caf7d --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkTypeValues.java @@ -0,0 +1,47 @@ +// 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 a new instance of LinkTypeValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LinkTypeValues() { + } + + /** + * 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/MetadataEntity.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntity.java new file mode 100644 index 000000000000..a43f930009d5 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntity.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.MetadataEntityInner; +import java.util.List; + +/** An immutable client-side representation of MetadataEntity. */ +public interface MetadataEntity { + /** + * 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 displayName property: The display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the dependsOn property: The list of keys on which this entity depends on. + * + * @return the dependsOn value. + */ + List dependsOn(); + + /** + * Gets the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @return the applicableScenarios value. + */ + List applicableScenarios(); + + /** + * Gets the supportedValues property: The list of supported values. + * + * @return the supportedValues value. + */ + List supportedValues(); + + /** + * Gets the inner com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner object. + * + * @return the inner object. + */ + MetadataEntityInner innerModel(); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntityListResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntityListResult.java new file mode 100644 index 000000000000..40b5ac7a1132 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntityListResult.java @@ -0,0 +1,81 @@ +// 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.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of metadata entities. */ +@Fluent +public final class MetadataEntityListResult { + /* + * The list of metadata entities. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of metadata. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of MetadataEntityListResult class. */ + public MetadataEntityListResult() { + } + + /** + * Get the value property: The list of metadata entities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of metadata entities. + * + * @param value the value value to set. + * @return the MetadataEntityListResult object itself. + */ + public MetadataEntityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of metadata. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of metadata. + * + * @param nextLink the nextLink value to set. + * @return the MetadataEntityListResult object itself. + */ + public MetadataEntityListResult 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) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataSupportedValueDetail.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataSupportedValueDetail.java new file mode 100644 index 000000000000..8ea6e745f897 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataSupportedValueDetail.java @@ -0,0 +1,103 @@ +// 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; + +/** The metadata supported value detail. */ +@Fluent +public final class MetadataSupportedValueDetail { + /* + * The id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The list of associated resource types. + */ + @JsonProperty(value = "resourceTypes") + private List resourceTypes; + + /** Creates an instance of MetadataSupportedValueDetail class. */ + public MetadataSupportedValueDetail() { + } + + /** + * Get the id property: The id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id. + * + * @param id the id value to set. + * @return the MetadataSupportedValueDetail object itself. + */ + public MetadataSupportedValueDetail withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName property: The display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name. + * + * @param displayName the displayName value to set. + * @return the MetadataSupportedValueDetail object itself. + */ + public MetadataSupportedValueDetail withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the resourceTypes property: The list of associated resource types. + * + * @return the resourceTypes value. + */ + public List resourceTypes() { + return this.resourceTypes; + } + + /** + * Set the resourceTypes property: The list of associated resource types. + * + * @param resourceTypes the resourceTypes value to set. + * @return the MetadataSupportedValueDetail object itself. + */ + public MetadataSupportedValueDetail withResourceTypes(List resourceTypes) { + this.resourceTypes = resourceTypes; + 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/Metadatas.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Metadatas.java new file mode 100644 index 000000000000..0453d241d8a6 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Metadatas.java @@ -0,0 +1,55 @@ +// 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 Metadatas. */ +public interface Metadatas { + /** + * Gets the list of metadata entities. + * + * @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 metadata entities as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the list of metadata entities. + * + * @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 metadata entities as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities along with {@link Response}. + */ + Response getEntityWithResponse(String name, Context context); + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 metadata entities. + */ + MetadataEntity getEntity(String name); +} 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 579057296d4a..3412da59380a 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 @@ -7,7 +7,7 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** Operation available in the resourcehealth resource provider. */ +/** Operation available in the Microsoft.ResourceHealth resource provider. */ @Fluent public final class Operation { /* diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/OperationListResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/OperationListResult.java index cf2fd4deb820..37d0cb2b0d2e 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/OperationListResult.java +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/OperationListResult.java @@ -10,7 +10,7 @@ /** An immutable client-side representation of OperationListResult. */ public interface OperationListResult { /** - * Gets the value property: List of operations available in the resourcehealth resource provider. + * Gets the value property: List of operations available in the Microsoft.ResourceHealth resource provider. * * @return the value value. */ 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 136088ae0ecd..e81c67fea30a 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 @@ -16,6 +16,15 @@ public final class ReasonChronicityTypes extends ExpandableStringEnum { + /** Static value Alerts for Scenario. */ + public static final Scenario ALERTS = fromString("Alerts"); + + /** + * Creates a new instance of Scenario value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Scenario() { + } + + /** + * Creates or finds a Scenario from its string representation. + * + * @param name a name to look for. + * @return the corresponding Scenario. + */ + @JsonCreator + public static Scenario fromString(String name) { + return fromString(name, Scenario.class); + } + + /** + * Gets known Scenario values. + * + * @return known Scenario values. + */ + public static Collection values() { + return values(Scenario.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SecurityAdvisoryImpactedResources.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SecurityAdvisoryImpactedResources.java new file mode 100644 index 000000000000..c5597104630b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SecurityAdvisoryImpactedResources.java @@ -0,0 +1,63 @@ +// 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 SecurityAdvisoryImpactedResources. */ +public interface SecurityAdvisoryImpactedResources { + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @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 (Security Advisory). + * + * @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); + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @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 listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SeverityValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SeverityValues.java new file mode 100644 index 000000000000..94cc08012b84 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SeverityValues.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; + +/** The severity level of this active event. */ +public final class SeverityValues extends ExpandableStringEnum { + /** Static value Information for SeverityValues. */ + public static final SeverityValues INFORMATION = fromString("Information"); + + /** Static value Warning for SeverityValues. */ + public static final SeverityValues WARNING = fromString("Warning"); + + /** Static value Error for SeverityValues. */ + public static final SeverityValues ERROR = fromString("Error"); + + /** + * Creates a new instance of SeverityValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SeverityValues() { + } + + /** + * Creates or finds a SeverityValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding SeverityValues. + */ + @JsonCreator + public static SeverityValues fromString(String name) { + return fromString(name, SeverityValues.class); + } + + /** + * Gets known SeverityValues values. + * + * @return known SeverityValues values. + */ + public static Collection values() { + return values(SeverityValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StageValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StageValues.java new file mode 100644 index 000000000000..2563885b0044 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StageValues.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; + +/** The stage of this active event. */ +public final class StageValues extends ExpandableStringEnum { + /** Static value Active for StageValues. */ + public static final StageValues ACTIVE = fromString("Active"); + + /** Static value Resolve for StageValues. */ + public static final StageValues RESOLVE = fromString("Resolve"); + + /** Static value Archived for StageValues. */ + public static final StageValues ARCHIVED = fromString("Archived"); + + /** + * Creates a new instance of StageValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StageValues() { + } + + /** + * Creates or finds a StageValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding StageValues. + */ + @JsonCreator + public static StageValues fromString(String name) { + return fromString(name, StageValues.class); + } + + /** + * Gets known StageValues values. + * + * @return known StageValues values. + */ + public static Collection values() { + return values(StageValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusActiveEvent.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusActiveEvent.java new file mode 100644 index 000000000000..290c05b09914 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusActiveEvent.java @@ -0,0 +1,289 @@ +// 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; + +/** Active event type of emerging issue. */ +@Fluent +public final class StatusActiveEvent { + /* + * The active event title. + */ + @JsonProperty(value = "title") + private String title; + + /* + * The details of active event. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The tracking id of this active event. + */ + @JsonProperty(value = "trackingId") + private String trackingId; + + /* + * The impact start time on this active event. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * The cloud type of this active event. + */ + @JsonProperty(value = "cloud") + private String cloud; + + /* + * The severity level of this active event. + */ + @JsonProperty(value = "severity") + private SeverityValues severity; + + /* + * The stage of this active event. + */ + @JsonProperty(value = "stage") + private StageValues stage; + + /* + * The boolean value of this active event if published or not. + */ + @JsonProperty(value = "published") + private Boolean published; + + /* + * The last time modified on this banner. + */ + @JsonProperty(value = "lastModifiedTime") + private OffsetDateTime lastModifiedTime; + + /* + * The list of emerging issues impacts. + */ + @JsonProperty(value = "impacts") + private List impacts; + + /** Creates an instance of StatusActiveEvent class. */ + public StatusActiveEvent() { + } + + /** + * Get the title property: The active event title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The active event title. + * + * @param title the title value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: The details of active event. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The details of active event. + * + * @param description the description value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the trackingId property: The tracking id of this active event. + * + * @return the trackingId value. + */ + public String trackingId() { + return this.trackingId; + } + + /** + * Set the trackingId property: The tracking id of this active event. + * + * @param trackingId the trackingId value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withTrackingId(String trackingId) { + this.trackingId = trackingId; + return this; + } + + /** + * Get the startTime property: The impact start time on this active event. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The impact start time on this active event. + * + * @param startTime the startTime value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the cloud property: The cloud type of this active event. + * + * @return the cloud value. + */ + public String cloud() { + return this.cloud; + } + + /** + * Set the cloud property: The cloud type of this active event. + * + * @param cloud the cloud value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withCloud(String cloud) { + this.cloud = cloud; + return this; + } + + /** + * Get the severity property: The severity level of this active event. + * + * @return the severity value. + */ + public SeverityValues severity() { + return this.severity; + } + + /** + * Set the severity property: The severity level of this active event. + * + * @param severity the severity value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withSeverity(SeverityValues severity) { + this.severity = severity; + return this; + } + + /** + * Get the stage property: The stage of this active event. + * + * @return the stage value. + */ + public StageValues stage() { + return this.stage; + } + + /** + * Set the stage property: The stage of this active event. + * + * @param stage the stage value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withStage(StageValues stage) { + this.stage = stage; + return this; + } + + /** + * Get the published property: The boolean value of this active event if published or not. + * + * @return the published value. + */ + public Boolean published() { + return this.published; + } + + /** + * Set the published property: The boolean value of this active event if published or not. + * + * @param published the published value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withPublished(Boolean published) { + this.published = published; + return this; + } + + /** + * Get the lastModifiedTime property: The last time modified on this banner. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Set the lastModifiedTime property: The last time modified on this banner. + * + * @param lastModifiedTime the lastModifiedTime value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withLastModifiedTime(OffsetDateTime lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + return this; + } + + /** + * Get the impacts property: The list of emerging issues impacts. + * + * @return the impacts value. + */ + public List impacts() { + return this.impacts; + } + + /** + * Set the impacts property: The list of emerging issues impacts. + * + * @param impacts the impacts value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withImpacts(List impacts) { + this.impacts = impacts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (impacts() != null) { + impacts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusBanner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusBanner.java new file mode 100644 index 000000000000..8ec124824428 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusBanner.java @@ -0,0 +1,129 @@ +// 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; + +/** Banner type of emerging issue. */ +@Fluent +public final class StatusBanner { + /* + * The banner title. + */ + @JsonProperty(value = "title") + private String title; + + /* + * The details of banner. + */ + @JsonProperty(value = "message") + private String message; + + /* + * The cloud type of this banner. + */ + @JsonProperty(value = "cloud") + private String cloud; + + /* + * The last time modified on this banner. + */ + @JsonProperty(value = "lastModifiedTime") + private OffsetDateTime lastModifiedTime; + + /** Creates an instance of StatusBanner class. */ + public StatusBanner() { + } + + /** + * Get the title property: The banner title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The banner title. + * + * @param title the title value to set. + * @return the StatusBanner object itself. + */ + public StatusBanner withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the message property: The details of banner. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The details of banner. + * + * @param message the message value to set. + * @return the StatusBanner object itself. + */ + public StatusBanner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the cloud property: The cloud type of this banner. + * + * @return the cloud value. + */ + public String cloud() { + return this.cloud; + } + + /** + * Set the cloud property: The cloud type of this banner. + * + * @param cloud the cloud value to set. + * @return the StatusBanner object itself. + */ + public StatusBanner withCloud(String cloud) { + this.cloud = cloud; + return this; + } + + /** + * Get the lastModifiedTime property: The last time modified on this banner. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Set the lastModifiedTime property: The last time modified on this banner. + * + * @param lastModifiedTime the lastModifiedTime value to set. + * @return the StatusBanner object itself. + */ + public StatusBanner withLastModifiedTime(OffsetDateTime lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + 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/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..71ba09cb9d34 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 @@ -4,12 +4,10 @@ package com.azure.resourcemanager.resourcehealth.generated; -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/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json */ /** * Sample code: GetCurrentHealthByResource. @@ -20,6 +18,6 @@ public static void getCurrentHealthByResource( com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { manager .availabilityStatuses() - .getByResourceWithResponse("resourceUri", null, "recommendedactions", Context.NONE); + .getByResourceWithResponse("resourceUri", null, "recommendedactions", com.azure.core.util.Context.NONE); } } 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..a4a92e5786af 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 @@ -4,12 +4,10 @@ package com.azure.resourcemanager.resourcehealth.generated; -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/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json */ /** * Sample code: ListByResourceGroup. @@ -19,6 +17,6 @@ public final class AvailabilityStatusesListByResourceGroupSamples { public static void listByResourceGroup(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { manager .availabilityStatuses() - .listByResourceGroup("resourceGroupName", null, "recommendedactions", Context.NONE); + .listByResourceGroup("resourceGroupName", null, "recommendedactions", com.azure.core.util.Context.NONE); } } 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..5956cb5ec49a 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 @@ -4,12 +4,10 @@ package com.azure.resourcemanager.resourcehealth.generated; -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/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json */ /** * Sample code: ListHealthBySubscriptionId. @@ -18,6 +16,8 @@ public final class AvailabilityStatusesListBySubscriptionIdSamples { */ public static void listHealthBySubscriptionId( com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { - manager.availabilityStatuses().listBySubscriptionId(null, "recommendedactions", Context.NONE); + manager + .availabilityStatuses() + .listBySubscriptionId(null, "recommendedactions", com.azure.core.util.Context.NONE); } } 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..7644e2d923a9 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 @@ -4,12 +4,10 @@ package com.azure.resourcemanager.resourcehealth.generated; -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/stable/2022-10-01/examples/AvailabilityStatuses_List.json */ /** * Sample code: GetHealthHistoryByResource. @@ -18,6 +16,6 @@ public final class AvailabilityStatusesListSamples { */ public static void getHealthHistoryByResource( com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { - manager.availabilityStatuses().list("resourceUri", null, null, Context.NONE); + manager.availabilityStatuses().list("resourceUri", null, null, com.azure.core.util.Context.NONE); } } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceSamples.java new file mode 100644 index 000000000000..c8d484425692 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceSamples.java @@ -0,0 +1,27 @@ +// 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; + +/** Samples for ChildAvailabilityStatuses GetByResource. */ +public final class ChildAvailabilityStatusesGetByResourceSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json + */ + /** + * Sample code: GetChildCurrentHealthByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getChildCurrentHealthByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .childAvailabilityStatuses() + .getByResourceWithResponse( + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", + null, + "recommendedactions", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListSamples.java new file mode 100644 index 000000000000..5f0c684c6a42 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListSamples.java @@ -0,0 +1,27 @@ +// 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; + +/** Samples for ChildAvailabilityStatuses List. */ +public final class ChildAvailabilityStatusesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json + */ + /** + * Sample code: GetChildHealthHistoryByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getChildHealthHistoryByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .childAvailabilityStatuses() + .list( + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListSamples.java new file mode 100644 index 000000000000..ed897190281c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListSamples.java @@ -0,0 +1,21 @@ +// 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; + +/** Samples for ChildResources List. */ +public final class ChildResourcesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json + */ + /** + * Sample code: GetCurrentChildHealthByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getCurrentChildHealthByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.childResources().list("resourceUri", null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetSamples.java new file mode 100644 index 000000000000..0db74f25b0dc --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetSamples.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.resourcemanager.resourcehealth.models.IssueNameParameter; + +/** Samples for EmergingIssues Get. */ +public final class EmergingIssuesGetSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + */ + /** + * Sample code: GetEmergingIssues. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getEmergingIssues(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.emergingIssues().getWithResponse(IssueNameParameter.DEFAULT, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListSamples.java new file mode 100644 index 000000000000..b7b1cbfa6e99 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListSamples.java @@ -0,0 +1,20 @@ +// 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; + +/** Samples for EmergingIssues List. */ +public final class EmergingIssuesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json + */ + /** + * Sample code: GetEmergingIssues. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getEmergingIssues(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.emergingIssues().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples.java new file mode 100644 index 000000000000..cb29283681fe --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples.java @@ -0,0 +1,23 @@ +// 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; + +/** Samples for EventOperation FetchDetailsBySubscriptionIdAndTrackingId. */ +public final class EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json + */ + /** + * Sample code: EventDetailsBySubscriptionIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventDetailsBySubscriptionIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .fetchDetailsBySubscriptionIdAndTrackingIdWithResponse("eventTrackingId", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsByTenantIdAndTrackingIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsByTenantIdAndTrackingIdSamples.java new file mode 100644 index 000000000000..1c9785590a07 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsByTenantIdAndTrackingIdSamples.java @@ -0,0 +1,23 @@ +// 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; + +/** Samples for EventOperation FetchDetailsByTenantIdAndTrackingId. */ +public final class EventOperationFetchDetailsByTenantIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json + */ + /** + * Sample code: EventDetailsByTenantIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventDetailsByTenantIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .fetchDetailsByTenantIdAndTrackingIdWithResponse("eventTrackingId", com.azure.core.util.Context.NONE); + } +} 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..d86822c705eb --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetBySubscriptionIdAndTrackingIdSamples.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; + +/** Samples for EventOperation GetBySubscriptionIdAndTrackingId. */ +public final class EventOperationGetBySubscriptionIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.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..f71ef111579b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetByTenantIdAndTrackingIdSamples.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; + +/** Samples for EventOperation GetByTenantIdAndTrackingId. */ +public final class EventOperationGetByTenantIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.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..349fd359f661 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListBySingleResourceSamples.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; + +/** Samples for EventsOperation ListBySingleResource. */ +public final class EventsOperationListBySingleResourceSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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, + com.azure.core.util.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..48ec5b4df008 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListByTenantIdSamples.java @@ -0,0 +1,23 @@ +// 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; + +/** Samples for EventsOperation ListByTenantId. */ +public final class EventsOperationListByTenantIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.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..117ee38090c8 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListSamples.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; + +/** Samples for EventsOperation List. */ +public final class EventsOperationListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdSamples.java new file mode 100644 index 000000000000..5c5c026ab89c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdSamples.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; + +/** Samples for ImpactedResources GetByTenantId. */ +public final class ImpactedResourcesGetByTenantIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + */ + /** + * Sample code: ImpactedResourcesGet. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void impactedResourcesGet(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .getByTenantIdWithResponse("BC_1-FXZ", "abc-123-ghj-456", com.azure.core.util.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..ac28fa587d22 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetSamples.java @@ -0,0 +1,20 @@ +// 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; + +/** Samples for ImpactedResources Get. */ +public final class ImpactedResourcesGetSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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", com.azure.core.util.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..cee1e82fe2ce --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdSamples.java @@ -0,0 +1,23 @@ +// 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; + +/** Samples for ImpactedResources ListBySubscriptionIdAndEventId. */ +public final class ImpactedResourcesListBySubscriptionIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/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'", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdSamples.java new file mode 100644 index 000000000000..bf50e9560c8f --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdSamples.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; + +/** Samples for ImpactedResources ListByTenantIdAndEventId. */ +public final class ImpactedResourcesListByTenantIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json + */ + /** + * Sample code: ListEventsByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsByTenantId(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .listByTenantIdAndEventId("BC_1-FXZ", "targetRegion eq 'westus'", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataGetEntitySamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataGetEntitySamples.java new file mode 100644 index 000000000000..bf5324d6cbec --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataGetEntitySamples.java @@ -0,0 +1,20 @@ +// 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; + +/** Samples for Metadata GetEntity. */ +public final class MetadataGetEntitySamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + */ + /** + * Sample code: GetMetadata. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getMetadata(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.metadatas().getEntityWithResponse("status", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataListSamples.java new file mode 100644 index 000000000000..a27f7d3d66cf --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataListSamples.java @@ -0,0 +1,20 @@ +// 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; + +/** Samples for Metadata List. */ +public final class MetadataListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json + */ + /** + * Sample code: GetMetadata. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getMetadata(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.metadatas().list(com.azure.core.util.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..15b5bf1c940a 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 @@ -4,20 +4,17 @@ package com.azure.resourcemanager.resourcehealth.generated; -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/stable/2022-10-01/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) { - manager.operations().listWithResponse(Context.NONE); + public static void getOperationsList(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); } } diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples.java new file mode 100644 index 000000000000..cc1e87860458 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples.java @@ -0,0 +1,23 @@ +// 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; + +/** Samples for SecurityAdvisoryImpactedResources ListBySubscriptionIdAndEventId. */ +public final class SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json + */ + /** + * Sample code: ListSecurityAdvisoryImpactedResourcesBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listSecurityAdvisoryImpactedResourcesBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .securityAdvisoryImpactedResources() + .listBySubscriptionIdAndEventId("BC_1-FXZ", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples.java new file mode 100644 index 000000000000..c876674bfb18 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples.java @@ -0,0 +1,23 @@ +// 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; + +/** Samples for SecurityAdvisoryImpactedResources ListByTenantIdAndEventId. */ +public final class SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json + */ + /** + * Sample code: ListSecurityAdvisoryImpactedResourcesByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listSecurityAdvisoryImpactedResourcesByTenantId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .securityAdvisoryImpactedResources() + .listByTenantIdAndEventId("BC_1-FXZ", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusInnerTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusInnerTests.java deleted file mode 100644 index 878155c4162d..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusInnerTests.java +++ /dev/null @@ -1,173 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusProperties; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusPropertiesRecentlyResolved; -import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; -import com.azure.resourcemanager.resourcehealth.models.RecommendedAction; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEvent; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class AvailabilityStatusInnerTests { - @Test - public void testDeserialize() { - AvailabilityStatusInner model = - BinaryData - .fromString( - "{\"id\":\"audccsnhs\",\"name\":\"nyejhkryhtnap\",\"type\":\"wlokjyem\",\"location\":\"vnipjox\",\"properties\":{\"availabilityState\":\"Degraded\",\"title\":\"gejspodmailzyde\",\"summary\":\"jwyahuxinpmqnja\",\"detailedStatus\":\"ixjsprozvcputeg\",\"reasonType\":\"wmfdatscmdvpjhul\",\"rootCauseAttributionTime\":\"2021-11-19T18:36:28Z\",\"healthEventType\":\"mkjozkrwf\",\"healthEventCause\":\"iodjp\",\"healthEventCategory\":\"w\",\"healthEventId\":\"dpvwryoqpsoaccta\",\"resolutionETA\":\"2021-06-15T10:03:50Z\",\"occuredTime\":\"2020-12-25T20:04:21Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-04-22T04:07:25Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2021-10-01T21:39:25Z\",\"resolvedTime\":\"2021-02-13T07:50:35Z\",\"unavailableSummary\":\"fdosyg\"},\"recommendedActions\":[{\"action\":\"ojakhmsbzjhcrze\",\"actionUrl\":\"phlxa\",\"actionUrlText\":\"thqt\"},{\"action\":\"qjbpfzfsin\",\"actionUrl\":\"v\",\"actionUrlText\":\"jrwzox\"},{\"action\":\"tfell\",\"actionUrl\":\"fziton\",\"actionUrlText\":\"qfpjk\"},{\"action\":\"xofpdvhpfxxypi\",\"actionUrl\":\"nmayhuybb\",\"actionUrlText\":\"odepoogin\"}],\"serviceImpactingEvents\":[{\"eventStartTime\":\"2021-11-03T11:27:22Z\",\"eventStatusLastModifiedTime\":\"2021-01-18T07:52:25Z\",\"correlationId\":\"gnarxzxtheo\"},{\"eventStartTime\":\"2021-09-30T22:34:52Z\",\"eventStatusLastModifiedTime\":\"2021-11-04T11:49:42Z\",\"correlationId\":\"cciqihnhungbwjz\"},{\"eventStartTime\":\"2021-11-04T09:44:48Z\",\"eventStatusLastModifiedTime\":\"2021-05-21T15:18:02Z\",\"correlationId\":\"pemvtzfkufubljof\"}]}}") - .toObject(AvailabilityStatusInner.class); - Assertions.assertEquals("audccsnhs", model.id()); - Assertions.assertEquals("nyejhkryhtnap", model.name()); - Assertions.assertEquals("wlokjyem", model.type()); - Assertions.assertEquals("vnipjox", model.location()); - Assertions.assertEquals(AvailabilityStateValues.DEGRADED, model.properties().availabilityState()); - Assertions.assertEquals("gejspodmailzyde", model.properties().title()); - Assertions.assertEquals("jwyahuxinpmqnja", model.properties().summary()); - Assertions.assertEquals("ixjsprozvcputeg", model.properties().detailedStatus()); - Assertions.assertEquals("wmfdatscmdvpjhul", model.properties().reasonType()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-11-19T18:36:28Z"), model.properties().rootCauseAttributionTime()); - Assertions.assertEquals("mkjozkrwf", model.properties().healthEventType()); - Assertions.assertEquals("iodjp", model.properties().healthEventCause()); - Assertions.assertEquals("w", model.properties().healthEventCategory()); - Assertions.assertEquals("dpvwryoqpsoaccta", model.properties().healthEventId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-15T10:03:50Z"), model.properties().resolutionEta()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-25T20:04:21Z"), model.properties().occuredTime()); - Assertions.assertEquals(ReasonChronicityTypes.TRANSIENT, model.properties().reasonChronicity()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-22T04:07:25Z"), model.properties().reportedTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-10-01T21:39:25Z"), - model.properties().recentlyResolved().unavailableOccuredTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-02-13T07:50:35Z"), model.properties().recentlyResolved().resolvedTime()); - Assertions.assertEquals("fdosyg", model.properties().recentlyResolved().unavailableSummary()); - Assertions.assertEquals("ojakhmsbzjhcrze", model.properties().recommendedActions().get(0).action()); - Assertions.assertEquals("phlxa", model.properties().recommendedActions().get(0).actionUrl()); - Assertions.assertEquals("thqt", model.properties().recommendedActions().get(0).actionUrlText()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-11-03T11:27:22Z"), - model.properties().serviceImpactingEvents().get(0).eventStartTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-01-18T07:52:25Z"), - model.properties().serviceImpactingEvents().get(0).eventStatusLastModifiedTime()); - Assertions.assertEquals("gnarxzxtheo", model.properties().serviceImpactingEvents().get(0).correlationId()); - } - - @Test - public void testSerialize() { - AvailabilityStatusInner model = - new AvailabilityStatusInner() - .withId("audccsnhs") - .withName("nyejhkryhtnap") - .withType("wlokjyem") - .withLocation("vnipjox") - .withProperties( - new AvailabilityStatusProperties() - .withAvailabilityState(AvailabilityStateValues.DEGRADED) - .withTitle("gejspodmailzyde") - .withSummary("jwyahuxinpmqnja") - .withDetailedStatus("ixjsprozvcputeg") - .withReasonType("wmfdatscmdvpjhul") - .withRootCauseAttributionTime(OffsetDateTime.parse("2021-11-19T18:36:28Z")) - .withHealthEventType("mkjozkrwf") - .withHealthEventCause("iodjp") - .withHealthEventCategory("w") - .withHealthEventId("dpvwryoqpsoaccta") - .withResolutionEta(OffsetDateTime.parse("2021-06-15T10:03:50Z")) - .withOccuredTime(OffsetDateTime.parse("2020-12-25T20:04:21Z")) - .withReasonChronicity(ReasonChronicityTypes.TRANSIENT) - .withReportedTime(OffsetDateTime.parse("2021-04-22T04:07:25Z")) - .withRecentlyResolved( - new AvailabilityStatusPropertiesRecentlyResolved() - .withUnavailableOccuredTime(OffsetDateTime.parse("2021-10-01T21:39:25Z")) - .withResolvedTime(OffsetDateTime.parse("2021-02-13T07:50:35Z")) - .withUnavailableSummary("fdosyg")) - .withRecommendedActions( - Arrays - .asList( - new RecommendedAction() - .withAction("ojakhmsbzjhcrze") - .withActionUrl("phlxa") - .withActionUrlText("thqt"), - new RecommendedAction() - .withAction("qjbpfzfsin") - .withActionUrl("v") - .withActionUrlText("jrwzox"), - new RecommendedAction() - .withAction("tfell") - .withActionUrl("fziton") - .withActionUrlText("qfpjk"), - new RecommendedAction() - .withAction("xofpdvhpfxxypi") - .withActionUrl("nmayhuybb") - .withActionUrlText("odepoogin"))) - .withServiceImpactingEvents( - Arrays - .asList( - new ServiceImpactingEvent() - .withEventStartTime(OffsetDateTime.parse("2021-11-03T11:27:22Z")) - .withEventStatusLastModifiedTime(OffsetDateTime.parse("2021-01-18T07:52:25Z")) - .withCorrelationId("gnarxzxtheo"), - new ServiceImpactingEvent() - .withEventStartTime(OffsetDateTime.parse("2021-09-30T22:34:52Z")) - .withEventStatusLastModifiedTime(OffsetDateTime.parse("2021-11-04T11:49:42Z")) - .withCorrelationId("cciqihnhungbwjz"), - new ServiceImpactingEvent() - .withEventStartTime(OffsetDateTime.parse("2021-11-04T09:44:48Z")) - .withEventStatusLastModifiedTime(OffsetDateTime.parse("2021-05-21T15:18:02Z")) - .withCorrelationId("pemvtzfkufubljof")))); - model = BinaryData.fromObject(model).toObject(AvailabilityStatusInner.class); - Assertions.assertEquals("audccsnhs", model.id()); - Assertions.assertEquals("nyejhkryhtnap", model.name()); - Assertions.assertEquals("wlokjyem", model.type()); - Assertions.assertEquals("vnipjox", model.location()); - Assertions.assertEquals(AvailabilityStateValues.DEGRADED, model.properties().availabilityState()); - Assertions.assertEquals("gejspodmailzyde", model.properties().title()); - Assertions.assertEquals("jwyahuxinpmqnja", model.properties().summary()); - Assertions.assertEquals("ixjsprozvcputeg", model.properties().detailedStatus()); - Assertions.assertEquals("wmfdatscmdvpjhul", model.properties().reasonType()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-11-19T18:36:28Z"), model.properties().rootCauseAttributionTime()); - Assertions.assertEquals("mkjozkrwf", model.properties().healthEventType()); - Assertions.assertEquals("iodjp", model.properties().healthEventCause()); - Assertions.assertEquals("w", model.properties().healthEventCategory()); - Assertions.assertEquals("dpvwryoqpsoaccta", model.properties().healthEventId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-15T10:03:50Z"), model.properties().resolutionEta()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-25T20:04:21Z"), model.properties().occuredTime()); - Assertions.assertEquals(ReasonChronicityTypes.TRANSIENT, model.properties().reasonChronicity()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-22T04:07:25Z"), model.properties().reportedTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-10-01T21:39:25Z"), - model.properties().recentlyResolved().unavailableOccuredTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-02-13T07:50:35Z"), model.properties().recentlyResolved().resolvedTime()); - Assertions.assertEquals("fdosyg", model.properties().recentlyResolved().unavailableSummary()); - Assertions.assertEquals("ojakhmsbzjhcrze", model.properties().recommendedActions().get(0).action()); - Assertions.assertEquals("phlxa", model.properties().recommendedActions().get(0).actionUrl()); - Assertions.assertEquals("thqt", model.properties().recommendedActions().get(0).actionUrlText()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-11-03T11:27:22Z"), - model.properties().serviceImpactingEvents().get(0).eventStartTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-01-18T07:52:25Z"), - model.properties().serviceImpactingEvents().get(0).eventStatusLastModifiedTime()); - Assertions.assertEquals("gnarxzxtheo", model.properties().serviceImpactingEvents().get(0).correlationId()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusListResultTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusListResultTests.java deleted file mode 100644 index ea94c2372f2f..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusListResultTests.java +++ /dev/null @@ -1,165 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusListResult; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusProperties; -import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class AvailabilityStatusListResultTests { - @Test - public void testDeserialize() { - AvailabilityStatusListResult model = - BinaryData - .fromString( - "{\"value\":[{\"id\":\"hq\",\"name\":\"gjxpybczmehmt\",\"type\":\"pbsphrupidgs\",\"location\":\"bejhphoycmsxa\",\"properties\":{\"availabilityState\":\"Degraded\",\"title\":\"bmtqioq\",\"summary\":\"ehtbm\",\"detailedStatus\":\"p\",\"reasonType\":\"noi\",\"rootCauseAttributionTime\":\"2021-08-05T07:19:53Z\",\"healthEventType\":\"rxybqsoq\",\"healthEventCause\":\"gkdmb\",\"healthEventCategory\":\"zlobcufpd\",\"healthEventId\":\"rbt\",\"resolutionETA\":\"2021-09-11T14:00:46Z\",\"occuredTime\":\"2021-05-11T18:58:09Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-03-31T06:52:57Z\",\"recommendedActions\":[],\"serviceImpactingEvents\":[]}},{\"id\":\"foooj\",\"name\":\"ifsqesaagdfmg\",\"type\":\"lhjxr\",\"location\":\"kwm\",\"properties\":{\"availabilityState\":\"Unknown\",\"title\":\"izntocipao\",\"summary\":\"jpsq\",\"detailedStatus\":\"mpoyfd\",\"reasonType\":\"ogknygjofjdd\",\"rootCauseAttributionTime\":\"2021-08-21T00:07:14Z\",\"healthEventType\":\"deupewnwrei\",\"healthEventCause\":\"zyf\",\"healthEventCategory\":\"sarhmofc\",\"healthEventId\":\"smy\",\"resolutionETA\":\"2021-02-14T18:03:27Z\",\"occuredTime\":\"2021-01-31T22:58:09Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-10-06T17:56:05Z\",\"recommendedActions\":[],\"serviceImpactingEvents\":[]}},{\"id\":\"sjtxukcdmp\",\"name\":\"cryuan\",\"type\":\"uxzdxtay\",\"location\":\"hmwhfpmrqo\",\"properties\":{\"availabilityState\":\"Available\",\"title\":\"knryrtihfxtij\",\"summary\":\"zvgnwzs\",\"detailedStatus\":\"glzufc\",\"reasonType\":\"kohdbiha\",\"rootCauseAttributionTime\":\"2021-07-21T15:51:12Z\",\"healthEventType\":\"fcbjysagithxqha\",\"healthEventCause\":\"fpikxwczb\",\"healthEventCategory\":\"cnpqxuhivyqniwby\",\"healthEventId\":\"k\",\"resolutionETA\":\"2021-04-25T05:12:43Z\",\"occuredTime\":\"2021-06-29T10:27:04Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-10-16T19:19:35Z\",\"recommendedActions\":[],\"serviceImpactingEvents\":[]}}],\"nextLink\":\"k\"}") - .toObject(AvailabilityStatusListResult.class); - Assertions.assertEquals("hq", model.value().get(0).id()); - Assertions.assertEquals("gjxpybczmehmt", model.value().get(0).name()); - Assertions.assertEquals("pbsphrupidgs", model.value().get(0).type()); - Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).location()); - Assertions - .assertEquals(AvailabilityStateValues.DEGRADED, model.value().get(0).properties().availabilityState()); - Assertions.assertEquals("bmtqioq", model.value().get(0).properties().title()); - Assertions.assertEquals("ehtbm", model.value().get(0).properties().summary()); - Assertions.assertEquals("p", model.value().get(0).properties().detailedStatus()); - Assertions.assertEquals("noi", model.value().get(0).properties().reasonType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-08-05T07:19:53Z"), - model.value().get(0).properties().rootCauseAttributionTime()); - Assertions.assertEquals("rxybqsoq", model.value().get(0).properties().healthEventType()); - Assertions.assertEquals("gkdmb", model.value().get(0).properties().healthEventCause()); - Assertions.assertEquals("zlobcufpd", model.value().get(0).properties().healthEventCategory()); - Assertions.assertEquals("rbt", model.value().get(0).properties().healthEventId()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-09-11T14:00:46Z"), model.value().get(0).properties().resolutionEta()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-05-11T18:58:09Z"), model.value().get(0).properties().occuredTime()); - Assertions.assertEquals(ReasonChronicityTypes.TRANSIENT, model.value().get(0).properties().reasonChronicity()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-03-31T06:52:57Z"), model.value().get(0).properties().reportedTime()); - Assertions.assertEquals("k", model.nextLink()); - } - - @Test - public void testSerialize() { - AvailabilityStatusListResult model = - new AvailabilityStatusListResult() - .withValue( - Arrays - .asList( - new AvailabilityStatusInner() - .withId("hq") - .withName("gjxpybczmehmt") - .withType("pbsphrupidgs") - .withLocation("bejhphoycmsxa") - .withProperties( - new AvailabilityStatusProperties() - .withAvailabilityState(AvailabilityStateValues.DEGRADED) - .withTitle("bmtqioq") - .withSummary("ehtbm") - .withDetailedStatus("p") - .withReasonType("noi") - .withRootCauseAttributionTime(OffsetDateTime.parse("2021-08-05T07:19:53Z")) - .withHealthEventType("rxybqsoq") - .withHealthEventCause("gkdmb") - .withHealthEventCategory("zlobcufpd") - .withHealthEventId("rbt") - .withResolutionEta(OffsetDateTime.parse("2021-09-11T14:00:46Z")) - .withOccuredTime(OffsetDateTime.parse("2021-05-11T18:58:09Z")) - .withReasonChronicity(ReasonChronicityTypes.TRANSIENT) - .withReportedTime(OffsetDateTime.parse("2021-03-31T06:52:57Z")) - .withRecommendedActions(Arrays.asList()) - .withServiceImpactingEvents(Arrays.asList())), - new AvailabilityStatusInner() - .withId("foooj") - .withName("ifsqesaagdfmg") - .withType("lhjxr") - .withLocation("kwm") - .withProperties( - new AvailabilityStatusProperties() - .withAvailabilityState(AvailabilityStateValues.UNKNOWN) - .withTitle("izntocipao") - .withSummary("jpsq") - .withDetailedStatus("mpoyfd") - .withReasonType("ogknygjofjdd") - .withRootCauseAttributionTime(OffsetDateTime.parse("2021-08-21T00:07:14Z")) - .withHealthEventType("deupewnwrei") - .withHealthEventCause("zyf") - .withHealthEventCategory("sarhmofc") - .withHealthEventId("smy") - .withResolutionEta(OffsetDateTime.parse("2021-02-14T18:03:27Z")) - .withOccuredTime(OffsetDateTime.parse("2021-01-31T22:58:09Z")) - .withReasonChronicity(ReasonChronicityTypes.TRANSIENT) - .withReportedTime(OffsetDateTime.parse("2021-10-06T17:56:05Z")) - .withRecommendedActions(Arrays.asList()) - .withServiceImpactingEvents(Arrays.asList())), - new AvailabilityStatusInner() - .withId("sjtxukcdmp") - .withName("cryuan") - .withType("uxzdxtay") - .withLocation("hmwhfpmrqo") - .withProperties( - new AvailabilityStatusProperties() - .withAvailabilityState(AvailabilityStateValues.AVAILABLE) - .withTitle("knryrtihfxtij") - .withSummary("zvgnwzs") - .withDetailedStatus("glzufc") - .withReasonType("kohdbiha") - .withRootCauseAttributionTime(OffsetDateTime.parse("2021-07-21T15:51:12Z")) - .withHealthEventType("fcbjysagithxqha") - .withHealthEventCause("fpikxwczb") - .withHealthEventCategory("cnpqxuhivyqniwby") - .withHealthEventId("k") - .withResolutionEta(OffsetDateTime.parse("2021-04-25T05:12:43Z")) - .withOccuredTime(OffsetDateTime.parse("2021-06-29T10:27:04Z")) - .withReasonChronicity(ReasonChronicityTypes.TRANSIENT) - .withReportedTime(OffsetDateTime.parse("2021-10-16T19:19:35Z")) - .withRecommendedActions(Arrays.asList()) - .withServiceImpactingEvents(Arrays.asList())))) - .withNextLink("k"); - model = BinaryData.fromObject(model).toObject(AvailabilityStatusListResult.class); - Assertions.assertEquals("hq", model.value().get(0).id()); - Assertions.assertEquals("gjxpybczmehmt", model.value().get(0).name()); - Assertions.assertEquals("pbsphrupidgs", model.value().get(0).type()); - Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).location()); - Assertions - .assertEquals(AvailabilityStateValues.DEGRADED, model.value().get(0).properties().availabilityState()); - Assertions.assertEquals("bmtqioq", model.value().get(0).properties().title()); - Assertions.assertEquals("ehtbm", model.value().get(0).properties().summary()); - Assertions.assertEquals("p", model.value().get(0).properties().detailedStatus()); - Assertions.assertEquals("noi", model.value().get(0).properties().reasonType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-08-05T07:19:53Z"), - model.value().get(0).properties().rootCauseAttributionTime()); - Assertions.assertEquals("rxybqsoq", model.value().get(0).properties().healthEventType()); - Assertions.assertEquals("gkdmb", model.value().get(0).properties().healthEventCause()); - Assertions.assertEquals("zlobcufpd", model.value().get(0).properties().healthEventCategory()); - Assertions.assertEquals("rbt", model.value().get(0).properties().healthEventId()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-09-11T14:00:46Z"), model.value().get(0).properties().resolutionEta()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-05-11T18:58:09Z"), model.value().get(0).properties().occuredTime()); - Assertions.assertEquals(ReasonChronicityTypes.TRANSIENT, model.value().get(0).properties().reasonChronicity()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-03-31T06:52:57Z"), model.value().get(0).properties().reportedTime()); - Assertions.assertEquals("k", model.nextLink()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusPropertiesRecentlyResolvedTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusPropertiesRecentlyResolvedTests.java deleted file mode 100644 index 848717601b08..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusPropertiesRecentlyResolvedTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusPropertiesRecentlyResolved; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class AvailabilityStatusPropertiesRecentlyResolvedTests { - @Test - public void testDeserialize() { - AvailabilityStatusPropertiesRecentlyResolved model = - BinaryData - .fromString( - "{\"unavailableOccuredTime\":\"2021-07-31T13:17:09Z\",\"resolvedTime\":\"2021-11-11T16:20:30Z\",\"unavailableSummary\":\"lyxwjkcprbnwbx\"}") - .toObject(AvailabilityStatusPropertiesRecentlyResolved.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T13:17:09Z"), model.unavailableOccuredTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-11T16:20:30Z"), model.resolvedTime()); - Assertions.assertEquals("lyxwjkcprbnwbx", model.unavailableSummary()); - } - - @Test - public void testSerialize() { - AvailabilityStatusPropertiesRecentlyResolved model = - new AvailabilityStatusPropertiesRecentlyResolved() - .withUnavailableOccuredTime(OffsetDateTime.parse("2021-07-31T13:17:09Z")) - .withResolvedTime(OffsetDateTime.parse("2021-11-11T16:20:30Z")) - .withUnavailableSummary("lyxwjkcprbnwbx"); - model = BinaryData.fromObject(model).toObject(AvailabilityStatusPropertiesRecentlyResolved.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T13:17:09Z"), model.unavailableOccuredTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-11T16:20:30Z"), model.resolvedTime()); - Assertions.assertEquals("lyxwjkcprbnwbx", model.unavailableSummary()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusPropertiesTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusPropertiesTests.java deleted file mode 100644 index e025432f2c32..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusPropertiesTests.java +++ /dev/null @@ -1,182 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusProperties; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusPropertiesRecentlyResolved; -import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; -import com.azure.resourcemanager.resourcehealth.models.RecommendedAction; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEvent; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEventIncidentProperties; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEventStatus; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class AvailabilityStatusPropertiesTests { - @Test - public void testDeserialize() { - AvailabilityStatusProperties model = - BinaryData - .fromString( - "{\"availabilityState\":\"Unavailable\",\"title\":\"aeqjhqjbasvms\",\"summary\":\"qulngsntnbybkzgc\",\"detailedStatus\":\"wclxxwrl\",\"reasonType\":\"ouskcqvkocrc\",\"rootCauseAttributionTime\":\"2021-02-11T18:18:15Z\",\"healthEventType\":\"tnhxbn\",\"healthEventCause\":\"iksqr\",\"healthEventCategory\":\"ssainqpjwnzll\",\"healthEventId\":\"mppeebvmgxs\",\"resolutionETA\":\"2020-12-29T22:13:05Z\",\"occuredTime\":\"2021-03-02T20:03:02Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-11-09T22:26:22Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2021-09-28T15:07:41Z\",\"resolvedTime\":\"2021-06-27T01:31:51Z\",\"unavailableSummary\":\"dzevndhkrw\"},\"recommendedActions\":[{\"action\":\"p\",\"actionUrl\":\"bdkvwrwjf\",\"actionUrlText\":\"snhu\"}],\"serviceImpactingEvents\":[{\"eventStartTime\":\"2021-03-06T17:49:31Z\",\"eventStatusLastModifiedTime\":\"2021-04-28T11:05:16Z\",\"correlationId\":\"dhugjzzdatqxhocd\",\"status\":{\"value\":\"blgphuticn\"},\"incidentProperties\":{\"title\":\"aozwyiftyhxhu\",\"service\":\"k\",\"region\":\"yxolniwp\",\"incidentType\":\"ukjfkgiawxklr\"}},{\"eventStartTime\":\"2021-02-17T21:17:55Z\",\"eventStatusLastModifiedTime\":\"2021-09-09T09:42:48Z\",\"correlationId\":\"basyy\",\"status\":{\"value\":\"dhsgcba\"},\"incidentProperties\":{\"title\":\"ejk\",\"service\":\"ynqgoulzndlikwyq\",\"region\":\"fgibmadgakeq\",\"incidentType\":\"xybz\"}},{\"eventStartTime\":\"2021-07-27T23:28:20Z\",\"eventStatusLastModifiedTime\":\"2021-10-01T07:35:11Z\",\"correlationId\":\"tbciqfouflmm\",\"status\":{\"value\":\"smodmgloug\"},\"incidentProperties\":{\"title\":\"wtmutduq\",\"service\":\"ap\",\"region\":\"wgcu\",\"incidentType\":\"tumkdosvqwhbm\"}},{\"eventStartTime\":\"2021-03-20T08:29Z\",\"eventStatusLastModifiedTime\":\"2021-05-05T10:20:27Z\",\"correlationId\":\"ddgmb\",\"status\":{\"value\":\"xppbhtqqro\"},\"incidentProperties\":{\"title\":\"fpsalgbqu\",\"service\":\"gjyjgzjaoyfhrtxi\",\"region\":\"erkujys\",\"incidentType\":\"eju\"}}]}") - .toObject(AvailabilityStatusProperties.class); - Assertions.assertEquals(AvailabilityStateValues.UNAVAILABLE, model.availabilityState()); - Assertions.assertEquals("aeqjhqjbasvms", model.title()); - Assertions.assertEquals("qulngsntnbybkzgc", model.summary()); - Assertions.assertEquals("wclxxwrl", model.detailedStatus()); - Assertions.assertEquals("ouskcqvkocrc", model.reasonType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-11T18:18:15Z"), model.rootCauseAttributionTime()); - Assertions.assertEquals("tnhxbn", model.healthEventType()); - Assertions.assertEquals("iksqr", model.healthEventCause()); - Assertions.assertEquals("ssainqpjwnzll", model.healthEventCategory()); - Assertions.assertEquals("mppeebvmgxs", model.healthEventId()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-29T22:13:05Z"), model.resolutionEta()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-02T20:03:02Z"), model.occuredTime()); - Assertions.assertEquals(ReasonChronicityTypes.TRANSIENT, model.reasonChronicity()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-09T22:26:22Z"), model.reportedTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-09-28T15:07:41Z"), model.recentlyResolved().unavailableOccuredTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-27T01:31:51Z"), model.recentlyResolved().resolvedTime()); - Assertions.assertEquals("dzevndhkrw", model.recentlyResolved().unavailableSummary()); - Assertions.assertEquals("p", model.recommendedActions().get(0).action()); - Assertions.assertEquals("bdkvwrwjf", model.recommendedActions().get(0).actionUrl()); - Assertions.assertEquals("snhu", model.recommendedActions().get(0).actionUrlText()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-03-06T17:49:31Z"), model.serviceImpactingEvents().get(0).eventStartTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-04-28T11:05:16Z"), - model.serviceImpactingEvents().get(0).eventStatusLastModifiedTime()); - Assertions.assertEquals("dhugjzzdatqxhocd", model.serviceImpactingEvents().get(0).correlationId()); - Assertions.assertEquals("blgphuticn", model.serviceImpactingEvents().get(0).status().value()); - Assertions.assertEquals("aozwyiftyhxhu", model.serviceImpactingEvents().get(0).incidentProperties().title()); - Assertions.assertEquals("k", model.serviceImpactingEvents().get(0).incidentProperties().service()); - Assertions.assertEquals("yxolniwp", model.serviceImpactingEvents().get(0).incidentProperties().region()); - Assertions - .assertEquals("ukjfkgiawxklr", model.serviceImpactingEvents().get(0).incidentProperties().incidentType()); - } - - @Test - public void testSerialize() { - AvailabilityStatusProperties model = - new AvailabilityStatusProperties() - .withAvailabilityState(AvailabilityStateValues.UNAVAILABLE) - .withTitle("aeqjhqjbasvms") - .withSummary("qulngsntnbybkzgc") - .withDetailedStatus("wclxxwrl") - .withReasonType("ouskcqvkocrc") - .withRootCauseAttributionTime(OffsetDateTime.parse("2021-02-11T18:18:15Z")) - .withHealthEventType("tnhxbn") - .withHealthEventCause("iksqr") - .withHealthEventCategory("ssainqpjwnzll") - .withHealthEventId("mppeebvmgxs") - .withResolutionEta(OffsetDateTime.parse("2020-12-29T22:13:05Z")) - .withOccuredTime(OffsetDateTime.parse("2021-03-02T20:03:02Z")) - .withReasonChronicity(ReasonChronicityTypes.TRANSIENT) - .withReportedTime(OffsetDateTime.parse("2021-11-09T22:26:22Z")) - .withRecentlyResolved( - new AvailabilityStatusPropertiesRecentlyResolved() - .withUnavailableOccuredTime(OffsetDateTime.parse("2021-09-28T15:07:41Z")) - .withResolvedTime(OffsetDateTime.parse("2021-06-27T01:31:51Z")) - .withUnavailableSummary("dzevndhkrw")) - .withRecommendedActions( - Arrays - .asList( - new RecommendedAction() - .withAction("p") - .withActionUrl("bdkvwrwjf") - .withActionUrlText("snhu"))) - .withServiceImpactingEvents( - Arrays - .asList( - new ServiceImpactingEvent() - .withEventStartTime(OffsetDateTime.parse("2021-03-06T17:49:31Z")) - .withEventStatusLastModifiedTime(OffsetDateTime.parse("2021-04-28T11:05:16Z")) - .withCorrelationId("dhugjzzdatqxhocd") - .withStatus(new ServiceImpactingEventStatus().withValue("blgphuticn")) - .withIncidentProperties( - new ServiceImpactingEventIncidentProperties() - .withTitle("aozwyiftyhxhu") - .withService("k") - .withRegion("yxolniwp") - .withIncidentType("ukjfkgiawxklr")), - new ServiceImpactingEvent() - .withEventStartTime(OffsetDateTime.parse("2021-02-17T21:17:55Z")) - .withEventStatusLastModifiedTime(OffsetDateTime.parse("2021-09-09T09:42:48Z")) - .withCorrelationId("basyy") - .withStatus(new ServiceImpactingEventStatus().withValue("dhsgcba")) - .withIncidentProperties( - new ServiceImpactingEventIncidentProperties() - .withTitle("ejk") - .withService("ynqgoulzndlikwyq") - .withRegion("fgibmadgakeq") - .withIncidentType("xybz")), - new ServiceImpactingEvent() - .withEventStartTime(OffsetDateTime.parse("2021-07-27T23:28:20Z")) - .withEventStatusLastModifiedTime(OffsetDateTime.parse("2021-10-01T07:35:11Z")) - .withCorrelationId("tbciqfouflmm") - .withStatus(new ServiceImpactingEventStatus().withValue("smodmgloug")) - .withIncidentProperties( - new ServiceImpactingEventIncidentProperties() - .withTitle("wtmutduq") - .withService("ap") - .withRegion("wgcu") - .withIncidentType("tumkdosvqwhbm")), - new ServiceImpactingEvent() - .withEventStartTime(OffsetDateTime.parse("2021-03-20T08:29Z")) - .withEventStatusLastModifiedTime(OffsetDateTime.parse("2021-05-05T10:20:27Z")) - .withCorrelationId("ddgmb") - .withStatus(new ServiceImpactingEventStatus().withValue("xppbhtqqro")) - .withIncidentProperties( - new ServiceImpactingEventIncidentProperties() - .withTitle("fpsalgbqu") - .withService("gjyjgzjaoyfhrtxi") - .withRegion("erkujys") - .withIncidentType("eju")))); - model = BinaryData.fromObject(model).toObject(AvailabilityStatusProperties.class); - Assertions.assertEquals(AvailabilityStateValues.UNAVAILABLE, model.availabilityState()); - Assertions.assertEquals("aeqjhqjbasvms", model.title()); - Assertions.assertEquals("qulngsntnbybkzgc", model.summary()); - Assertions.assertEquals("wclxxwrl", model.detailedStatus()); - Assertions.assertEquals("ouskcqvkocrc", model.reasonType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-11T18:18:15Z"), model.rootCauseAttributionTime()); - Assertions.assertEquals("tnhxbn", model.healthEventType()); - Assertions.assertEquals("iksqr", model.healthEventCause()); - Assertions.assertEquals("ssainqpjwnzll", model.healthEventCategory()); - Assertions.assertEquals("mppeebvmgxs", model.healthEventId()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-29T22:13:05Z"), model.resolutionEta()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-02T20:03:02Z"), model.occuredTime()); - Assertions.assertEquals(ReasonChronicityTypes.TRANSIENT, model.reasonChronicity()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-09T22:26:22Z"), model.reportedTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-09-28T15:07:41Z"), model.recentlyResolved().unavailableOccuredTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-27T01:31:51Z"), model.recentlyResolved().resolvedTime()); - Assertions.assertEquals("dzevndhkrw", model.recentlyResolved().unavailableSummary()); - Assertions.assertEquals("p", model.recommendedActions().get(0).action()); - Assertions.assertEquals("bdkvwrwjf", model.recommendedActions().get(0).actionUrl()); - Assertions.assertEquals("snhu", model.recommendedActions().get(0).actionUrlText()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-03-06T17:49:31Z"), model.serviceImpactingEvents().get(0).eventStartTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-04-28T11:05:16Z"), - model.serviceImpactingEvents().get(0).eventStatusLastModifiedTime()); - Assertions.assertEquals("dhugjzzdatqxhocd", model.serviceImpactingEvents().get(0).correlationId()); - Assertions.assertEquals("blgphuticn", model.serviceImpactingEvents().get(0).status().value()); - Assertions.assertEquals("aozwyiftyhxhu", model.serviceImpactingEvents().get(0).incidentProperties().title()); - Assertions.assertEquals("k", model.serviceImpactingEvents().get(0).incidentProperties().service()); - Assertions.assertEquals("yxolniwp", model.serviceImpactingEvents().get(0).incidentProperties().region()); - Assertions - .assertEquals("ukjfkgiawxklr", model.serviceImpactingEvents().get(0).incidentProperties().incidentType()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesGetByResourceWithResponseMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesGetByResourceWithResponseMockTests.java deleted file mode 100644 index 640e896989ab..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesGetByResourceWithResponseMockTests.java +++ /dev/null @@ -1,100 +0,0 @@ -// 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.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; -import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AvailabilityStatusesGetByResourceWithResponseMockTests { - @Test - public void testGetByResourceWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"id\":\"cbonqvpk\",\"name\":\"rxnjeaseipheofl\",\"type\":\"eyy\",\"location\":\"nj\",\"properties\":{\"availabilityState\":\"Degraded\",\"title\":\"grhpdjpju\",\"summary\":\"sxazjpq\",\"detailedStatus\":\"gual\",\"reasonType\":\"xxhejjzzvd\",\"rootCauseAttributionTime\":\"2021-03-06T13:07:05Z\",\"healthEventType\":\"dslfhotwmcy\",\"healthEventCause\":\"wlbjnpgacftade\",\"healthEventCategory\":\"nltyfsoppusuesnz\",\"healthEventId\":\"ej\",\"resolutionETA\":\"2021-07-08T00:18:36Z\",\"occuredTime\":\"2021-04-30T04:35:54Z\",\"reasonChronicity\":\"Persistent\",\"reportedTime\":\"2021-03-31T13:31:51Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2021-07-20T12:25:55Z\",\"resolvedTime\":\"2021-07-18T19:44:05Z\",\"unavailableSummary\":\"vudwx\"},\"recommendedActions\":[],\"serviceImpactingEvents\":[]}}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ResourceHealthManager manager = - ResourceHealthManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AvailabilityStatus response = - manager - .availabilityStatuses() - .getByResourceWithResponse("al", "nwsubisnj", "mpmngnzscxaqwoo", Context.NONE) - .getValue(); - - Assertions.assertEquals("cbonqvpk", response.id()); - Assertions.assertEquals("rxnjeaseipheofl", response.name()); - Assertions.assertEquals("eyy", response.type()); - Assertions.assertEquals("nj", response.location()); - Assertions.assertEquals(AvailabilityStateValues.DEGRADED, response.properties().availabilityState()); - Assertions.assertEquals("grhpdjpju", response.properties().title()); - Assertions.assertEquals("sxazjpq", response.properties().summary()); - Assertions.assertEquals("gual", response.properties().detailedStatus()); - Assertions.assertEquals("xxhejjzzvd", response.properties().reasonType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-03-06T13:07:05Z"), response.properties().rootCauseAttributionTime()); - Assertions.assertEquals("dslfhotwmcy", response.properties().healthEventType()); - Assertions.assertEquals("wlbjnpgacftade", response.properties().healthEventCause()); - Assertions.assertEquals("nltyfsoppusuesnz", response.properties().healthEventCategory()); - Assertions.assertEquals("ej", response.properties().healthEventId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-08T00:18:36Z"), response.properties().resolutionEta()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-30T04:35:54Z"), response.properties().occuredTime()); - Assertions.assertEquals(ReasonChronicityTypes.PERSISTENT, response.properties().reasonChronicity()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-31T13:31:51Z"), response.properties().reportedTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-07-20T12:25:55Z"), - response.properties().recentlyResolved().unavailableOccuredTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-07-18T19:44:05Z"), response.properties().recentlyResolved().resolvedTime()); - Assertions.assertEquals("vudwx", response.properties().recentlyResolved().unavailableSummary()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListByResourceGroupMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListByResourceGroupMockTests.java deleted file mode 100644 index 4fdb60a1d4cb..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListByResourceGroupMockTests.java +++ /dev/null @@ -1,110 +0,0 @@ -// 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.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; -import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AvailabilityStatusesListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"id\":\"vdfgiotk\",\"name\":\"utqxlngx\",\"type\":\"fgugnxkrxdqmid\",\"location\":\"hzrvqd\",\"properties\":{\"availabilityState\":\"Unknown\",\"title\":\"yb\",\"summary\":\"ehoqfbowskan\",\"detailedStatus\":\"tzlcuiywgqywgn\",\"reasonType\":\"vynhzgpphrcg\",\"rootCauseAttributionTime\":\"2021-08-18T07:24:05Z\",\"healthEventType\":\"cpecfvmmcoofs\",\"healthEventCause\":\"zevgb\",\"healthEventCategory\":\"jqabcypmivkwlzuv\",\"healthEventId\":\"fwnfnb\",\"resolutionETA\":\"2021-04-04T07:21:26Z\",\"occuredTime\":\"2021-04-16T12:59:12Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-03-20T17:28:20Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2021-04-06T03:12:38Z\",\"resolvedTime\":\"2021-11-29T00:22:10Z\",\"unavailableSummary\":\"zxdpnqbqqw\"},\"recommendedActions\":[],\"serviceImpactingEvents\":[]}}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ResourceHealthManager manager = - ResourceHealthManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.availabilityStatuses().listByResourceGroup("u", "m", "uhrzayvvt", Context.NONE); - - Assertions.assertEquals("vdfgiotk", response.iterator().next().id()); - Assertions.assertEquals("utqxlngx", response.iterator().next().name()); - Assertions.assertEquals("fgugnxkrxdqmid", response.iterator().next().type()); - Assertions.assertEquals("hzrvqd", response.iterator().next().location()); - Assertions - .assertEquals(AvailabilityStateValues.UNKNOWN, response.iterator().next().properties().availabilityState()); - Assertions.assertEquals("yb", response.iterator().next().properties().title()); - Assertions.assertEquals("ehoqfbowskan", response.iterator().next().properties().summary()); - Assertions.assertEquals("tzlcuiywgqywgn", response.iterator().next().properties().detailedStatus()); - Assertions.assertEquals("vynhzgpphrcg", response.iterator().next().properties().reasonType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-08-18T07:24:05Z"), - response.iterator().next().properties().rootCauseAttributionTime()); - Assertions.assertEquals("cpecfvmmcoofs", response.iterator().next().properties().healthEventType()); - Assertions.assertEquals("zevgb", response.iterator().next().properties().healthEventCause()); - Assertions.assertEquals("jqabcypmivkwlzuv", response.iterator().next().properties().healthEventCategory()); - Assertions.assertEquals("fwnfnb", response.iterator().next().properties().healthEventId()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-04-04T07:21:26Z"), response.iterator().next().properties().resolutionEta()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-04-16T12:59:12Z"), response.iterator().next().properties().occuredTime()); - Assertions - .assertEquals(ReasonChronicityTypes.TRANSIENT, response.iterator().next().properties().reasonChronicity()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-03-20T17:28:20Z"), response.iterator().next().properties().reportedTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-04-06T03:12:38Z"), - response.iterator().next().properties().recentlyResolved().unavailableOccuredTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-11-29T00:22:10Z"), - response.iterator().next().properties().recentlyResolved().resolvedTime()); - Assertions - .assertEquals( - "zxdpnqbqqw", response.iterator().next().properties().recentlyResolved().unavailableSummary()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListBySubscriptionIdMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListBySubscriptionIdMockTests.java deleted file mode 100644 index ca3011b3c033..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListBySubscriptionIdMockTests.java +++ /dev/null @@ -1,110 +0,0 @@ -// 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.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; -import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AvailabilityStatusesListBySubscriptionIdMockTests { - @Test - public void testListBySubscriptionId() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"id\":\"lwhijcoejctbzaq\",\"name\":\"sycbkbfk\",\"type\":\"kdkexxp\",\"location\":\"fmxa\",\"properties\":{\"availabilityState\":\"Available\",\"title\":\"gddtocj\",\"summary\":\"hvpmoue\",\"detailedStatus\":\"dzxibqeojnxqbzvd\",\"reasonType\":\"t\",\"rootCauseAttributionTime\":\"2021-05-08T12:29:29Z\",\"healthEventType\":\"icbtwnpzao\",\"healthEventCause\":\"uhrhcffcyddgl\",\"healthEventCategory\":\"t\",\"healthEventId\":\"qkwpyeicxmqc\",\"resolutionETA\":\"2021-08-11T13:08:26Z\",\"occuredTime\":\"2021-01-16T07:23:11Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-01-03T15:56:28Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2021-04-28T05:58:26Z\",\"resolvedTime\":\"2021-12-07T01:46:53Z\",\"unavailableSummary\":\"pbobjo\"},\"recommendedActions\":[],\"serviceImpactingEvents\":[]}}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ResourceHealthManager manager = - ResourceHealthManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.availabilityStatuses().listBySubscriptionId("aajrm", "djwzrlov", Context.NONE); - - Assertions.assertEquals("lwhijcoejctbzaq", response.iterator().next().id()); - Assertions.assertEquals("sycbkbfk", response.iterator().next().name()); - Assertions.assertEquals("kdkexxp", response.iterator().next().type()); - Assertions.assertEquals("fmxa", response.iterator().next().location()); - Assertions - .assertEquals( - AvailabilityStateValues.AVAILABLE, response.iterator().next().properties().availabilityState()); - Assertions.assertEquals("gddtocj", response.iterator().next().properties().title()); - Assertions.assertEquals("hvpmoue", response.iterator().next().properties().summary()); - Assertions.assertEquals("dzxibqeojnxqbzvd", response.iterator().next().properties().detailedStatus()); - Assertions.assertEquals("t", response.iterator().next().properties().reasonType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-05-08T12:29:29Z"), - response.iterator().next().properties().rootCauseAttributionTime()); - Assertions.assertEquals("icbtwnpzao", response.iterator().next().properties().healthEventType()); - Assertions.assertEquals("uhrhcffcyddgl", response.iterator().next().properties().healthEventCause()); - Assertions.assertEquals("t", response.iterator().next().properties().healthEventCategory()); - Assertions.assertEquals("qkwpyeicxmqc", response.iterator().next().properties().healthEventId()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-08-11T13:08:26Z"), response.iterator().next().properties().resolutionEta()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-01-16T07:23:11Z"), response.iterator().next().properties().occuredTime()); - Assertions - .assertEquals(ReasonChronicityTypes.TRANSIENT, response.iterator().next().properties().reasonChronicity()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-01-03T15:56:28Z"), response.iterator().next().properties().reportedTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-04-28T05:58:26Z"), - response.iterator().next().properties().recentlyResolved().unavailableOccuredTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-12-07T01:46:53Z"), - response.iterator().next().properties().recentlyResolved().resolvedTime()); - Assertions - .assertEquals("pbobjo", response.iterator().next().properties().recentlyResolved().unavailableSummary()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListMockTests.java deleted file mode 100644 index df44682a6f56..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/AvailabilityStatusesListMockTests.java +++ /dev/null @@ -1,109 +0,0 @@ -// 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.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; -import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; -import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AvailabilityStatusesListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"id\":\"fqweykhmene\",\"name\":\"yexfwh\",\"type\":\"cibvyvdcsitynn\",\"location\":\"mdectehfiqscjey\",\"properties\":{\"availabilityState\":\"Unknown\",\"title\":\"rkgqhcjrefo\",\"summary\":\"mkqsleyyv\",\"detailedStatus\":\"qjpkcattpngjcrc\",\"reasonType\":\"sqpjhvmdajvn\",\"rootCauseAttributionTime\":\"2021-10-10T23:28:16Z\",\"healthEventType\":\"nqecanoaeup\",\"healthEventCause\":\"yhltrpmopjmcm\",\"healthEventCategory\":\"u\",\"healthEventId\":\"thfuiuaodsfcpkvx\",\"resolutionETA\":\"2021-07-31T05:00:25Z\",\"occuredTime\":\"2021-06-07T12:26:40Z\",\"reasonChronicity\":\"Persistent\",\"reportedTime\":\"2021-02-09T15:41:34Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2021-04-04T08:44:05Z\",\"resolvedTime\":\"2021-10-16T04:11:54Z\",\"unavailableSummary\":\"axbezyiuo\"},\"recommendedActions\":[],\"serviceImpactingEvents\":[]}}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ResourceHealthManager manager = - ResourceHealthManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.availabilityStatuses().list("owgujjugwdkcglhs", "azjdyggd", "jixhbk", Context.NONE); - - Assertions.assertEquals("fqweykhmene", response.iterator().next().id()); - Assertions.assertEquals("yexfwh", response.iterator().next().name()); - Assertions.assertEquals("cibvyvdcsitynn", response.iterator().next().type()); - Assertions.assertEquals("mdectehfiqscjey", response.iterator().next().location()); - Assertions - .assertEquals(AvailabilityStateValues.UNKNOWN, response.iterator().next().properties().availabilityState()); - Assertions.assertEquals("rkgqhcjrefo", response.iterator().next().properties().title()); - Assertions.assertEquals("mkqsleyyv", response.iterator().next().properties().summary()); - Assertions.assertEquals("qjpkcattpngjcrc", response.iterator().next().properties().detailedStatus()); - Assertions.assertEquals("sqpjhvmdajvn", response.iterator().next().properties().reasonType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-10-10T23:28:16Z"), - response.iterator().next().properties().rootCauseAttributionTime()); - Assertions.assertEquals("nqecanoaeup", response.iterator().next().properties().healthEventType()); - Assertions.assertEquals("yhltrpmopjmcm", response.iterator().next().properties().healthEventCause()); - Assertions.assertEquals("u", response.iterator().next().properties().healthEventCategory()); - Assertions.assertEquals("thfuiuaodsfcpkvx", response.iterator().next().properties().healthEventId()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-07-31T05:00:25Z"), response.iterator().next().properties().resolutionEta()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-06-07T12:26:40Z"), response.iterator().next().properties().occuredTime()); - Assertions - .assertEquals(ReasonChronicityTypes.PERSISTENT, response.iterator().next().properties().reasonChronicity()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-02-09T15:41:34Z"), response.iterator().next().properties().reportedTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-04-04T08:44:05Z"), - response.iterator().next().properties().recentlyResolved().unavailableOccuredTime()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-10-16T04:11:54Z"), - response.iterator().next().properties().recentlyResolved().resolvedTime()); - Assertions - .assertEquals("axbezyiuo", response.iterator().next().properties().recentlyResolved().unavailableSummary()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationDisplayTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationDisplayTests.java deleted file mode 100644 index 7ee5ce934036..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationDisplayTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class OperationDisplayTests { - @Test - public void testDeserialize() { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"bdxkqpxokaj\",\"resource\":\"npime\",\"operation\":\"stxgc\",\"description\":\"dg\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("bdxkqpxokaj", model.provider()); - Assertions.assertEquals("npime", model.resource()); - Assertions.assertEquals("stxgc", model.operation()); - Assertions.assertEquals("dg", model.description()); - } - - @Test - public void testSerialize() { - OperationDisplay model = - new OperationDisplay() - .withProvider("bdxkqpxokaj") - .withResource("npime") - .withOperation("stxgc") - .withDescription("dg"); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("bdxkqpxokaj", model.provider()); - Assertions.assertEquals("npime", model.resource()); - Assertions.assertEquals("stxgc", model.operation()); - Assertions.assertEquals("dg", model.description()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationListResultInnerTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationListResultInnerTests.java deleted file mode 100644 index 10f0e7ff08de..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationListResultInnerTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.fluent.models.OperationListResultInner; -import com.azure.resourcemanager.resourcehealth.models.Operation; -import com.azure.resourcemanager.resourcehealth.models.OperationDisplay; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class OperationListResultInnerTests { - @Test - public void testDeserialize() { - OperationListResultInner model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"iachbo\",\"display\":{\"provider\":\"lnrosfqp\",\"resource\":\"ehzzvypyqrim\",\"operation\":\"npvswjdkirso\",\"description\":\"qxhcrmn\"}},{\"name\":\"jtckwhdso\",\"display\":{\"provider\":\"yip\",\"resource\":\"sqwpgrjb\",\"operation\":\"orcjxvsnby\",\"description\":\"abnmocpcyshu\"}},{\"name\":\"afbljjgpbtoqcjmk\",\"display\":{\"provider\":\"vbqid\",\"resource\":\"ajzyul\",\"operation\":\"u\",\"description\":\"krlkhbzhfepg\"}}]}") - .toObject(OperationListResultInner.class); - Assertions.assertEquals("iachbo", model.value().get(0).name()); - Assertions.assertEquals("lnrosfqp", model.value().get(0).display().provider()); - Assertions.assertEquals("ehzzvypyqrim", model.value().get(0).display().resource()); - Assertions.assertEquals("npvswjdkirso", model.value().get(0).display().operation()); - Assertions.assertEquals("qxhcrmn", model.value().get(0).display().description()); - } - - @Test - public void testSerialize() { - OperationListResultInner model = - new OperationListResultInner() - .withValue( - Arrays - .asList( - new Operation() - .withName("iachbo") - .withDisplay( - new OperationDisplay() - .withProvider("lnrosfqp") - .withResource("ehzzvypyqrim") - .withOperation("npvswjdkirso") - .withDescription("qxhcrmn")), - new Operation() - .withName("jtckwhdso") - .withDisplay( - new OperationDisplay() - .withProvider("yip") - .withResource("sqwpgrjb") - .withOperation("orcjxvsnby") - .withDescription("abnmocpcyshu")), - new Operation() - .withName("afbljjgpbtoqcjmk") - .withDisplay( - new OperationDisplay() - .withProvider("vbqid") - .withResource("ajzyul") - .withOperation("u") - .withDescription("krlkhbzhfepg")))); - model = BinaryData.fromObject(model).toObject(OperationListResultInner.class); - Assertions.assertEquals("iachbo", model.value().get(0).name()); - Assertions.assertEquals("lnrosfqp", model.value().get(0).display().provider()); - Assertions.assertEquals("ehzzvypyqrim", model.value().get(0).display().resource()); - Assertions.assertEquals("npvswjdkirso", model.value().get(0).display().operation()); - Assertions.assertEquals("qxhcrmn", model.value().get(0).display().description()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationTests.java deleted file mode 100644 index c299e40e5b94..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.models.Operation; -import com.azure.resourcemanager.resourcehealth.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class OperationTests { - @Test - public void testDeserialize() { - Operation model = - BinaryData - .fromString( - "{\"name\":\"qex\",\"display\":{\"provider\":\"c\",\"resource\":\"c\",\"operation\":\"ierhhbcsglummaj\",\"description\":\"aodxo\"}}") - .toObject(Operation.class); - Assertions.assertEquals("qex", model.name()); - Assertions.assertEquals("c", model.display().provider()); - Assertions.assertEquals("c", model.display().resource()); - Assertions.assertEquals("ierhhbcsglummaj", model.display().operation()); - Assertions.assertEquals("aodxo", model.display().description()); - } - - @Test - public void testSerialize() { - Operation model = - new Operation() - .withName("qex") - .withDisplay( - new OperationDisplay() - .withProvider("c") - .withResource("c") - .withOperation("ierhhbcsglummaj") - .withDescription("aodxo")); - model = BinaryData.fromObject(model).toObject(Operation.class); - Assertions.assertEquals("qex", model.name()); - Assertions.assertEquals("c", model.display().provider()); - Assertions.assertEquals("c", model.display().resource()); - Assertions.assertEquals("ierhhbcsglummaj", model.display().operation()); - Assertions.assertEquals("aodxo", model.display().description()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationsListWithResponseMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationsListWithResponseMockTests.java deleted file mode 100644 index 1a4b5139b48d..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/OperationsListWithResponseMockTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// 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.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; -import com.azure.resourcemanager.resourcehealth.models.OperationListResult; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class OperationsListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{\"value\":[{\"name\":\"xw\"},{\"name\":\"q\"},{\"name\":\"surex\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ResourceHealthManager manager = - ResourceHealthManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - OperationListResult response = manager.operations().listWithResponse(Context.NONE).getValue(); - - Assertions.assertEquals("xw", response.value().get(0).name()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/RecommendedActionTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/RecommendedActionTests.java deleted file mode 100644 index 5d9ce9a57053..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/RecommendedActionTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.models.RecommendedAction; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class RecommendedActionTests { - @Test - public void testDeserialize() { - RecommendedAction model = - BinaryData - .fromString("{\"action\":\"vtb\",\"actionUrl\":\"ysszdnrujqguh\",\"actionUrlText\":\"ouqfprwz\"}") - .toObject(RecommendedAction.class); - Assertions.assertEquals("vtb", model.action()); - Assertions.assertEquals("ysszdnrujqguh", model.actionUrl()); - Assertions.assertEquals("ouqfprwz", model.actionUrlText()); - } - - @Test - public void testSerialize() { - RecommendedAction model = - new RecommendedAction().withAction("vtb").withActionUrl("ysszdnrujqguh").withActionUrlText("ouqfprwz"); - model = BinaryData.fromObject(model).toObject(RecommendedAction.class); - Assertions.assertEquals("vtb", model.action()); - Assertions.assertEquals("ysszdnrujqguh", model.actionUrl()); - Assertions.assertEquals("ouqfprwz", model.actionUrlText()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventIncidentPropertiesTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventIncidentPropertiesTests.java deleted file mode 100644 index 716b9b8ff75f..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventIncidentPropertiesTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEventIncidentProperties; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class ServiceImpactingEventIncidentPropertiesTests { - @Test - public void testDeserialize() { - ServiceImpactingEventIncidentProperties model = - BinaryData - .fromString( - "{\"title\":\"fufsrpymzi\",\"service\":\"sezcxtb\",\"region\":\"gfycc\",\"incidentType\":\"ewmdw\"}") - .toObject(ServiceImpactingEventIncidentProperties.class); - Assertions.assertEquals("fufsrpymzi", model.title()); - Assertions.assertEquals("sezcxtb", model.service()); - Assertions.assertEquals("gfycc", model.region()); - Assertions.assertEquals("ewmdw", model.incidentType()); - } - - @Test - public void testSerialize() { - ServiceImpactingEventIncidentProperties model = - new ServiceImpactingEventIncidentProperties() - .withTitle("fufsrpymzi") - .withService("sezcxtb") - .withRegion("gfycc") - .withIncidentType("ewmdw"); - model = BinaryData.fromObject(model).toObject(ServiceImpactingEventIncidentProperties.class); - Assertions.assertEquals("fufsrpymzi", model.title()); - Assertions.assertEquals("sezcxtb", model.service()); - Assertions.assertEquals("gfycc", model.region()); - Assertions.assertEquals("ewmdw", model.incidentType()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventStatusTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventStatusTests.java deleted file mode 100644 index a281a44dfa46..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventStatusTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEventStatus; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class ServiceImpactingEventStatusTests { - @Test - public void testDeserialize() { - ServiceImpactingEventStatus model = - BinaryData.fromString("{\"value\":\"waopvkmijcmmxd\"}").toObject(ServiceImpactingEventStatus.class); - Assertions.assertEquals("waopvkmijcmmxd", model.value()); - } - - @Test - public void testSerialize() { - ServiceImpactingEventStatus model = new ServiceImpactingEventStatus().withValue("waopvkmijcmmxd"); - model = BinaryData.fromObject(model).toObject(ServiceImpactingEventStatus.class); - Assertions.assertEquals("waopvkmijcmmxd", model.value()); - } -} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventTests.java deleted file mode 100644 index 56e3b87bfe28..000000000000 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ServiceImpactingEventTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// 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.BinaryData; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEvent; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEventIncidentProperties; -import com.azure.resourcemanager.resourcehealth.models.ServiceImpactingEventStatus; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class ServiceImpactingEventTests { - @Test - public void testDeserialize() { - ServiceImpactingEvent model = - BinaryData - .fromString( - "{\"eventStartTime\":\"2021-05-23T15:38:51Z\",\"eventStatusLastModifiedTime\":\"2021-02-08T12:52:46Z\",\"correlationId\":\"tnwu\",\"status\":{\"value\":\"a\"},\"incidentProperties\":{\"title\":\"fizuckyf\",\"service\":\"rfidfvzwdz\",\"region\":\"tymw\",\"incidentType\":\"dkfthwxmnt\"}}") - .toObject(ServiceImpactingEvent.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-23T15:38:51Z"), model.eventStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T12:52:46Z"), model.eventStatusLastModifiedTime()); - Assertions.assertEquals("tnwu", model.correlationId()); - Assertions.assertEquals("a", model.status().value()); - Assertions.assertEquals("fizuckyf", model.incidentProperties().title()); - Assertions.assertEquals("rfidfvzwdz", model.incidentProperties().service()); - Assertions.assertEquals("tymw", model.incidentProperties().region()); - Assertions.assertEquals("dkfthwxmnt", model.incidentProperties().incidentType()); - } - - @Test - public void testSerialize() { - ServiceImpactingEvent model = - new ServiceImpactingEvent() - .withEventStartTime(OffsetDateTime.parse("2021-05-23T15:38:51Z")) - .withEventStatusLastModifiedTime(OffsetDateTime.parse("2021-02-08T12:52:46Z")) - .withCorrelationId("tnwu") - .withStatus(new ServiceImpactingEventStatus().withValue("a")) - .withIncidentProperties( - new ServiceImpactingEventIncidentProperties() - .withTitle("fizuckyf") - .withService("rfidfvzwdz") - .withRegion("tymw") - .withIncidentType("dkfthwxmnt")); - model = BinaryData.fromObject(model).toObject(ServiceImpactingEvent.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-23T15:38:51Z"), model.eventStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T12:52:46Z"), model.eventStatusLastModifiedTime()); - Assertions.assertEquals("tnwu", model.correlationId()); - Assertions.assertEquals("a", model.status().value()); - Assertions.assertEquals("fizuckyf", model.incidentProperties().title()); - Assertions.assertEquals("rfidfvzwdz", model.incidentProperties().service()); - Assertions.assertEquals("tymw", model.incidentProperties().region()); - Assertions.assertEquals("dkfthwxmnt", model.incidentProperties().incidentType()); - } -}