diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md b/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md index da80fe2f436b..eb174624e460 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md @@ -1,5 +1,86 @@ # Release History +## 1.2.0 (2023-05-26) +### Features Added + +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `EventLevelValues` with values `EventLevelValuesCritical`, `EventLevelValuesError`, `EventLevelValuesInformational`, `EventLevelValuesWarning` +- New enum type `EventSourceValues` with values `EventSourceValuesResourceHealth`, `EventSourceValuesServiceHealth` +- New enum type `EventStatusValues` with values `EventStatusValuesActive`, `EventStatusValuesResolved` +- New enum type `EventTypeValues` with values `EventTypeValuesEmergingIssues`, `EventTypeValuesHealthAdvisory`, `EventTypeValuesPlannedMaintenance`, `EventTypeValuesRCA`, `EventTypeValuesSecurityAdvisory`, `EventTypeValuesServiceIssue` +- New enum type `IssueNameParameter` with values `IssueNameParameterDefault` +- New enum type `LevelValues` with values `LevelValuesCritical`, `LevelValuesWarning` +- New enum type `LinkTypeValues` with values `LinkTypeValuesButton`, `LinkTypeValuesHyperlink` +- New enum type `Scenario` with values `ScenarioAlerts` +- New enum type `SeverityValues` with values `SeverityValuesError`, `SeverityValuesInformation`, `SeverityValuesWarning` +- New enum type `StageValues` with values `StageValuesActive`, `StageValuesArchived`, `StageValuesResolve` +- New function `NewChildAvailabilityStatusesClient(azcore.TokenCredential, *arm.ClientOptions) (*ChildAvailabilityStatusesClient, error)` +- New function `*ChildAvailabilityStatusesClient.GetByResource(context.Context, string, *ChildAvailabilityStatusesClientGetByResourceOptions) (ChildAvailabilityStatusesClientGetByResourceResponse, error)` +- New function `*ChildAvailabilityStatusesClient.NewListPager(string, *ChildAvailabilityStatusesClientListOptions) *runtime.Pager[ChildAvailabilityStatusesClientListResponse]` +- New function `NewChildResourcesClient(azcore.TokenCredential, *arm.ClientOptions) (*ChildResourcesClient, error)` +- New function `*ChildResourcesClient.NewListPager(string, *ChildResourcesClientListOptions) *runtime.Pager[ChildResourcesClientListResponse]` +- New function `*ClientFactory.NewChildAvailabilityStatusesClient() *ChildAvailabilityStatusesClient` +- New function `*ClientFactory.NewChildResourcesClient() *ChildResourcesClient` +- New function `*ClientFactory.NewEmergingIssuesClient() *EmergingIssuesClient` +- New function `*ClientFactory.NewEventClient() *EventClient` +- New function `*ClientFactory.NewEventsClient() *EventsClient` +- New function `*ClientFactory.NewImpactedResourcesClient() *ImpactedResourcesClient` +- New function `*ClientFactory.NewMetadataClient() *MetadataClient` +- New function `*ClientFactory.NewSecurityAdvisoryImpactedResourcesClient() *SecurityAdvisoryImpactedResourcesClient` +- New function `NewEmergingIssuesClient(azcore.TokenCredential, *arm.ClientOptions) (*EmergingIssuesClient, error)` +- New function `*EmergingIssuesClient.Get(context.Context, IssueNameParameter, *EmergingIssuesClientGetOptions) (EmergingIssuesClientGetResponse, error)` +- New function `*EmergingIssuesClient.NewListPager(*EmergingIssuesClientListOptions) *runtime.Pager[EmergingIssuesClientListResponse]` +- New function `NewEventClient(string, azcore.TokenCredential, *arm.ClientOptions) (*EventClient, error)` +- New function `*EventClient.FetchDetailsBySubscriptionIDAndTrackingID(context.Context, string, *EventClientFetchDetailsBySubscriptionIDAndTrackingIDOptions) (EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse, error)` +- New function `*EventClient.FetchDetailsByTenantIDAndTrackingID(context.Context, string, *EventClientFetchDetailsByTenantIDAndTrackingIDOptions) (EventClientFetchDetailsByTenantIDAndTrackingIDResponse, error)` +- New function `*EventClient.GetBySubscriptionIDAndTrackingID(context.Context, string, *EventClientGetBySubscriptionIDAndTrackingIDOptions) (EventClientGetBySubscriptionIDAndTrackingIDResponse, error)` +- New function `*EventClient.GetByTenantIDAndTrackingID(context.Context, string, *EventClientGetByTenantIDAndTrackingIDOptions) (EventClientGetByTenantIDAndTrackingIDResponse, error)` +- New function `NewEventsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*EventsClient, error)` +- New function `*EventsClient.NewListBySingleResourcePager(string, *EventsClientListBySingleResourceOptions) *runtime.Pager[EventsClientListBySingleResourceResponse]` +- New function `*EventsClient.NewListBySubscriptionIDPager(*EventsClientListBySubscriptionIDOptions) *runtime.Pager[EventsClientListBySubscriptionIDResponse]` +- New function `*EventsClient.NewListByTenantIDPager(*EventsClientListByTenantIDOptions) *runtime.Pager[EventsClientListByTenantIDResponse]` +- New function `NewImpactedResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ImpactedResourcesClient, error)` +- New function `*ImpactedResourcesClient.Get(context.Context, string, string, *ImpactedResourcesClientGetOptions) (ImpactedResourcesClientGetResponse, error)` +- New function `*ImpactedResourcesClient.GetByTenantID(context.Context, string, string, *ImpactedResourcesClientGetByTenantIDOptions) (ImpactedResourcesClientGetByTenantIDResponse, error)` +- New function `*ImpactedResourcesClient.NewListBySubscriptionIDAndEventIDPager(string, *ImpactedResourcesClientListBySubscriptionIDAndEventIDOptions) *runtime.Pager[ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse]` +- New function `*ImpactedResourcesClient.NewListByTenantIDAndEventIDPager(string, *ImpactedResourcesClientListByTenantIDAndEventIDOptions) *runtime.Pager[ImpactedResourcesClientListByTenantIDAndEventIDResponse]` +- New function `NewMetadataClient(azcore.TokenCredential, *arm.ClientOptions) (*MetadataClient, error)` +- New function `*MetadataClient.GetEntity(context.Context, string, *MetadataClientGetEntityOptions) (MetadataClientGetEntityResponse, error)` +- New function `*MetadataClient.NewListPager(*MetadataClientListOptions) *runtime.Pager[MetadataClientListResponse]` +- New function `NewSecurityAdvisoryImpactedResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SecurityAdvisoryImpactedResourcesClient, error)` +- New function `*SecurityAdvisoryImpactedResourcesClient.NewListBySubscriptionIDAndEventIDPager(string, *SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDOptions) *runtime.Pager[SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse]` +- New function `*SecurityAdvisoryImpactedResourcesClient.NewListByTenantIDAndEventIDPager(string, *SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDOptions) *runtime.Pager[SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse]` +- New struct `EmergingIssue` +- New struct `EmergingIssueImpact` +- New struct `EmergingIssueListResult` +- New struct `EmergingIssuesGetResult` +- New struct `Event` +- New struct `EventImpactedResource` +- New struct `EventImpactedResourceListResult` +- New struct `EventImpactedResourceProperties` +- New struct `EventProperties` +- New struct `EventPropertiesAdditionalInformation` +- New struct `EventPropertiesArticle` +- New struct `EventPropertiesRecommendedActions` +- New struct `EventPropertiesRecommendedActionsItem` +- New struct `Events` +- New struct `Faq` +- New struct `Impact` +- New struct `ImpactedServiceRegion` +- New struct `KeyValueItem` +- New struct `Link` +- New struct `LinkDisplayText` +- New struct `MetadataEntity` +- New struct `MetadataEntityListResult` +- New struct `MetadataEntityProperties` +- New struct `MetadataSupportedValueDetail` +- New struct `StatusActiveEvent` +- New struct `SystemData` +- New struct `Update` +- New field `ArticleID`, `Category`, `Context` in struct `AvailabilityStatusProperties` +- New field `ActionURLComment` in struct `RecommendedAction` + + ## 1.1.0 (2023-03-31) ### Features Added diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md b/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md index 9b1e6a8e7b75..ba26f4dd5805 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md @@ -5,8 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcehealth/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcehealth/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 +module-version: 1.2.0 +tag: package-2022-10 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client.go index 4b0c0a9274a6..0ac84c7cdc1b 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client.go @@ -29,8 +29,7 @@ type AvailabilityStatusesClient struct { } // NewAvailabilityStatusesClient creates a new instance of AvailabilityStatusesClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAvailabilityStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailabilityStatusesClient, error) { @@ -48,7 +47,7 @@ func NewAvailabilityStatusesClient(subscriptionID string, credential azcore.Toke // GetByResource - Gets current availability status for a single resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-05-01 +// Generated from API version 2022-10-01 // - 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} @@ -80,7 +79,7 @@ func (client *AvailabilityStatusesClient) getByResourceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2022-10-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -103,7 +102,7 @@ func (client *AvailabilityStatusesClient) getByResourceHandleResponse(resp *http // NewListPager - Lists all historical availability transitions and impacting events for a single resource. // -// Generated from API version 2020-05-01 +// Generated from API version 2022-10-01 // - 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} @@ -148,7 +147,7 @@ func (client *AvailabilityStatusesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2022-10-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -171,8 +170,8 @@ func (client *AvailabilityStatusesClient) listHandleResponse(resp *http.Response // NewListByResourceGroupPager - Lists the current availability status for all the resources in the resource group. // -// Generated from API version 2020-05-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2022-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AvailabilityStatusesClientListByResourceGroupOptions contains the optional parameters for the AvailabilityStatusesClient.NewListByResourceGroupPager // method. func (client *AvailabilityStatusesClient) NewListByResourceGroupPager(resourceGroupName string, options *AvailabilityStatusesClientListByResourceGroupOptions) *runtime.Pager[AvailabilityStatusesClientListByResourceGroupResponse] { @@ -219,7 +218,7 @@ func (client *AvailabilityStatusesClient) listByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2022-10-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -242,7 +241,7 @@ func (client *AvailabilityStatusesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionIDPager - Lists the current availability status for all the resources in the subscription. // -// Generated from API version 2020-05-01 +// Generated from API version 2022-10-01 // - options - AvailabilityStatusesClientListBySubscriptionIDOptions contains the optional parameters for the AvailabilityStatusesClient.NewListBySubscriptionIDPager // method. func (client *AvailabilityStatusesClient) NewListBySubscriptionIDPager(options *AvailabilityStatusesClientListBySubscriptionIDOptions) *runtime.Pager[AvailabilityStatusesClientListBySubscriptionIDResponse] { @@ -285,7 +284,7 @@ func (client *AvailabilityStatusesClient) listBySubscriptionIDCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2022-10-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client_example_test.go index 8f7a5e8cd847..1a66f2f30337 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client_example_test.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_ListBySubscriptionId.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json func ExampleAvailabilityStatusesClient_NewListBySubscriptionIDPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -51,14 +51,16 @@ func ExampleAvailabilityStatusesClient_NewListBySubscriptionIDPager() { // Location: to.Ptr("eastus"), // Properties: &armresourcehealth.AvailabilityStatusProperties{ // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // Category: to.Ptr("Unplanned"), + // Context: to.Ptr("Platform Initiated"), // DetailedStatus: to.Ptr("We have not seen any issues with your virtual machine"), // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-29T09:12:00Z"); return t}()), // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), // ReasonType: to.Ptr("Unplanned"), // RecentlyResolved: &armresourcehealth.AvailabilityStatusPropertiesRecentlyResolved{ // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-28T00:49:00Z"); return t}()), - // UnavailabilitySummary: to.Ptr("We are sorry your SQL database is unavailable"), // UnavailableOccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-28T00:48:00Z"); return t}()), + // UnavailabilitySummary: to.Ptr("We are sorry your SQL database is unavailable"), // }, // RecommendedActions: []*armresourcehealth.RecommendedAction{ // { @@ -104,7 +106,7 @@ func ExampleAvailabilityStatusesClient_NewListBySubscriptionIDPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json func ExampleAvailabilityStatusesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,14 +139,16 @@ func ExampleAvailabilityStatusesClient_NewListByResourceGroupPager() { // Location: to.Ptr("eastus"), // Properties: &armresourcehealth.AvailabilityStatusProperties{ // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // Category: to.Ptr("Unplanned"), + // Context: to.Ptr("Platform Initiated"), // DetailedStatus: to.Ptr("We have not seen any issues with your virtual machine"), // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-29T09:12:00Z"); return t}()), // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), // ReasonType: to.Ptr("Unplanned"), // RecentlyResolved: &armresourcehealth.AvailabilityStatusPropertiesRecentlyResolved{ // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-28T00:49:00Z"); return t}()), - // UnavailabilitySummary: to.Ptr("We are sorry your SQL database is unavailable"), // UnavailableOccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-28T00:48:00Z"); return t}()), + // UnavailabilitySummary: to.Ptr("We are sorry your SQL database is unavailable"), // }, // RecommendedActions: []*armresourcehealth.RecommendedAction{ // { @@ -190,7 +194,7 @@ func ExampleAvailabilityStatusesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatus_GetByResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json func ExampleAvailabilityStatusesClient_GetByResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -217,6 +221,8 @@ func ExampleAvailabilityStatusesClient_GetByResource() { // Location: to.Ptr("eastus"), // Properties: &armresourcehealth.AvailabilityStatusProperties{ // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesUnavailable), + // Category: to.Ptr("Unplanned"), + // Context: to.Ptr("Platform Initiated"), // DetailedStatus: to.Ptr("Disk problems are preventing us from automatically recovering your virtual machine"), // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-29T09:12:00Z"); return t}()), // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), @@ -241,7 +247,7 @@ func ExampleAvailabilityStatusesClient_GetByResource() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json func ExampleAvailabilityStatusesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -274,6 +280,8 @@ func ExampleAvailabilityStatusesClient_NewListPager() { // Location: to.Ptr("eastus"), // Properties: &armresourcehealth.AvailabilityStatusProperties{ // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesUnavailable), + // Category: to.Ptr("Unplanned"), + // Context: to.Ptr("Platform Initiated"), // DetailedStatus: to.Ptr("Disk problems are preventing us from automatically recovering your virtual machine"), // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-29T09:12:00Z"); return t}()), // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/build.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/build.go index 572c1f135cdd..31442bc6d8fb 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/build.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/resourcehealth/armresourcehealth +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/resourcehealth/armresourcehealth package armresourcehealth diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/childavailabilitystatuses_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/childavailabilitystatuses_client.go new file mode 100644 index 000000000000..997b70bf6321 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/childavailabilitystatuses_client.go @@ -0,0 +1,161 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// ChildAvailabilityStatusesClient contains the methods for the ChildAvailabilityStatuses group. +// Don't use this type directly, use NewChildAvailabilityStatusesClient() instead. +type ChildAvailabilityStatusesClient struct { + internal *arm.Client +} + +// NewChildAvailabilityStatusesClient creates a new instance of ChildAvailabilityStatusesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewChildAvailabilityStatusesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ChildAvailabilityStatusesClient, error) { + cl, err := arm.NewClient(moduleName+".ChildAvailabilityStatusesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ChildAvailabilityStatusesClient{ + internal: cl, + } + return client, nil +} + +// GetByResource - Gets current availability status for a single resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - 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} +// - options - ChildAvailabilityStatusesClientGetByResourceOptions contains the optional parameters for the ChildAvailabilityStatusesClient.GetByResource +// method. +func (client *ChildAvailabilityStatusesClient) GetByResource(ctx context.Context, resourceURI string, options *ChildAvailabilityStatusesClientGetByResourceOptions) (ChildAvailabilityStatusesClientGetByResourceResponse, error) { + req, err := client.getByResourceCreateRequest(ctx, resourceURI, options) + if err != nil { + return ChildAvailabilityStatusesClientGetByResourceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ChildAvailabilityStatusesClientGetByResourceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ChildAvailabilityStatusesClientGetByResourceResponse{}, runtime.NewResponseError(resp) + } + return client.getByResourceHandleResponse(resp) +} + +// getByResourceCreateRequest creates the GetByResource request. +func (client *ChildAvailabilityStatusesClient) getByResourceCreateRequest(ctx context.Context, resourceURI string, options *ChildAvailabilityStatusesClientGetByResourceOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByResourceHandleResponse handles the GetByResource response. +func (client *ChildAvailabilityStatusesClient) getByResourceHandleResponse(resp *http.Response) (ChildAvailabilityStatusesClientGetByResourceResponse, error) { + result := ChildAvailabilityStatusesClientGetByResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatus); err != nil { + return ChildAvailabilityStatusesClientGetByResourceResponse{}, err + } + return result, nil +} + +// NewListPager - 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 +// +// Generated from API version 2022-10-01 +// - 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} +// - options - ChildAvailabilityStatusesClientListOptions contains the optional parameters for the ChildAvailabilityStatusesClient.NewListPager +// method. +func (client *ChildAvailabilityStatusesClient) NewListPager(resourceURI string, options *ChildAvailabilityStatusesClientListOptions) *runtime.Pager[ChildAvailabilityStatusesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ChildAvailabilityStatusesClientListResponse]{ + More: func(page ChildAvailabilityStatusesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ChildAvailabilityStatusesClientListResponse) (ChildAvailabilityStatusesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceURI, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ChildAvailabilityStatusesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ChildAvailabilityStatusesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ChildAvailabilityStatusesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ChildAvailabilityStatusesClient) listCreateRequest(ctx context.Context, resourceURI string, options *ChildAvailabilityStatusesClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ChildAvailabilityStatusesClient) listHandleResponse(resp *http.Response) (ChildAvailabilityStatusesClientListResponse, error) { + result := ChildAvailabilityStatusesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatusListResult); err != nil { + return ChildAvailabilityStatusesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/childavailabilitystatuses_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/childavailabilitystatuses_client_example_test.go new file mode 100644 index 000000000000..ae36e8d7a6c1 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/childavailabilitystatuses_client_example_test.go @@ -0,0 +1,227 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json +func ExampleChildAvailabilityStatusesClient_GetByResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewChildAvailabilityStatusesClient().GetByResource(ctx, "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", &armresourcehealth.ChildAvailabilityStatusesClientGetByResourceOptions{Filter: nil, + Expand: to.Ptr("recommendedactions"), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AvailabilityStatus = armresourcehealth.AvailabilityStatus{ + // Name: to.Ptr("current"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4/providers/Microsoft.ResourceHealth/child/availabilityStatuses/current"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:37:44Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), + // ReasonType: to.Ptr(""), + // RecommendedActions: []*armresourcehealth.RecommendedAction{ + // { + // Action: to.Ptr("To start this virtual machine, open the resource blade and click Start"), + // ActionURL: to.Ptr("<#ResourceBlade>"), + // ActionURLText: to.Ptr("resource blade"), + // }, + // { + // Action: to.Ptr("If you are experiencing problems you believe are caused by Azure, contact support"), + // ActionURL: to.Ptr("<#SupportCase>"), + // ActionURLText: to.Ptr("contact support"), + // }}, + // ReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-04T01:19:11.955255Z"); return t}()), + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json +func ExampleChildAvailabilityStatusesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewChildAvailabilityStatusesClient().NewListPager("subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", &armresourcehealth.ChildAvailabilityStatusesClientListOptions{Filter: nil, + Expand: nil, + }) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AvailabilityStatusListResult = armresourcehealth.AvailabilityStatusListResult{ + // Value: []*armresourcehealth.AvailabilityStatus{ + // { + // Name: to.Ptr("current"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4/providers/Microsoft.ResourceHealth/availabilityStatuses/current"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:37:44Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesTransient), + // ReasonType: to.Ptr(""), + // RecommendedActions: []*armresourcehealth.RecommendedAction{ + // { + // Action: to.Ptr("If you're having problems, use the Troubleshoot tool to get recommended solutions."), + // ActionURL: to.Ptr("<#TroubleshootV2Blade>"), + // ActionURLText: to.Ptr("Troubleshoot tool"), + // }, + // { + // Action: to.Ptr("If you are experiencing problems you believe are caused by Azure, contact support"), + // ActionURL: to.Ptr("<#SupportCase>"), + // ActionURLText: to.Ptr("contact support"), + // }}, + // ReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-05T19:45:45.6640838Z"); return t}()), + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // }, + // { + // Name: to.Ptr("2018-11-30+23%3a36%3a03Z"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4/providers/Microsoft.ResourceHealth/availabilityStatuses/2018-11-30+23%3a36%3a03Z"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesUnavailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:36:03Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesTransient), + // ReasonType: to.Ptr("Customer Initiated"), + // RecommendedActions: []*armresourcehealth.RecommendedAction{ + // { + // Action: to.Ptr("Check back here for status updates"), + // ActionURL: to.Ptr(""), + // ActionURLText: to.Ptr(""), + // }, + // { + // Action: to.Ptr("If you are experiencing problems you believe are caused by Azure, contact support"), + // ActionURL: to.Ptr("<#SupportCase>"), + // ActionURLText: to.Ptr("contact support"), + // }}, + // ResolutionETA: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:56:03Z"); return t}()), + // RootCauseAttributionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:36:02.514Z"); return t}()), + // Summary: to.Ptr("This virtual machine is rebooting as requested by an authorized user or process. It will be back online after the reboot completes."), + // }, + // }, + // { + // Name: to.Ptr("2018-11-30+22%3a32%3a12Z"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4/providers/Microsoft.ResourceHealth/availabilityStatuses/2018-11-30+22%3a32%3a12Z"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T22:32:12Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesTransient), + // ReasonType: to.Ptr(""), + // RecommendedActions: []*armresourcehealth.RecommendedAction{ + // { + // Action: to.Ptr("If you're having problems, use the Troubleshoot tool to get recommended solutions."), + // ActionURL: to.Ptr("<#TroubleshootV2Blade>"), + // ActionURLText: to.Ptr("Troubleshoot tool"), + // }, + // { + // Action: to.Ptr("If you are experiencing problems you believe are caused by Azure, contact support"), + // ActionURL: to.Ptr("<#SupportCase>"), + // ActionURLText: to.Ptr("contact support"), + // }}, + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // }, + // { + // Name: to.Ptr("2018-11-30+22%3a30%3a23Z"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4/providers/Microsoft.ResourceHealth/availabilityStatuses/2018-11-30+22%3a30%3a23Z"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesUnavailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T22:30:23Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesTransient), + // ReasonType: to.Ptr("Customer Initiated"), + // RecommendedActions: []*armresourcehealth.RecommendedAction{ + // { + // Action: to.Ptr("Check back here for status updates"), + // ActionURL: to.Ptr(""), + // ActionURLText: to.Ptr(""), + // }, + // { + // Action: to.Ptr("If you are experiencing problems you believe are caused by Azure, contact support"), + // ActionURL: to.Ptr("<#SupportCase>"), + // ActionURLText: to.Ptr("contact support"), + // }}, + // ResolutionETA: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T22:50:23Z"); return t}()), + // RootCauseAttributionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T22:30:22.256Z"); return t}()), + // Summary: to.Ptr("This virtual machine is rebooting as requested by an authorized user or process. It will be back online after the reboot completes."), + // }, + // }, + // { + // Name: to.Ptr("2018-11-21+00%3a00%3a00Z"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4/providers/Microsoft.ResourceHealth/availabilityStatuses/2018-11-21+00%3a00%3a00Z"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-21T00:00:00Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesTransient), + // ReasonType: to.Ptr(""), + // RecommendedActions: []*armresourcehealth.RecommendedAction{ + // { + // Action: to.Ptr("If you're having problems, use the Troubleshoot tool to get recommended solutions."), + // ActionURL: to.Ptr("<#TroubleshootV2Blade>"), + // ActionURLText: to.Ptr("Troubleshoot tool"), + // }, + // { + // Action: to.Ptr("If you are experiencing problems you believe are caused by Azure, contact support"), + // ActionURL: to.Ptr("<#SupportCase>"), + // ActionURLText: to.Ptr("contact support"), + // }}, + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/childresources_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/childresources_client.go new file mode 100644 index 000000000000..f79316632e85 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/childresources_client.go @@ -0,0 +1,106 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// ChildResourcesClient contains the methods for the ChildResources group. +// Don't use this type directly, use NewChildResourcesClient() instead. +type ChildResourcesClient struct { + internal *arm.Client +} + +// NewChildResourcesClient creates a new instance of ChildResourcesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewChildResourcesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ChildResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".ChildResourcesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ChildResourcesClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - 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 +// +// Generated from API version 2022-10-01 +// - 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} +// - options - ChildResourcesClientListOptions contains the optional parameters for the ChildResourcesClient.NewListPager method. +func (client *ChildResourcesClient) NewListPager(resourceURI string, options *ChildResourcesClientListOptions) *runtime.Pager[ChildResourcesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ChildResourcesClientListResponse]{ + More: func(page ChildResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ChildResourcesClientListResponse) (ChildResourcesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceURI, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ChildResourcesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ChildResourcesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ChildResourcesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ChildResourcesClient) listCreateRequest(ctx context.Context, resourceURI string, options *ChildResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ChildResourcesClient) listHandleResponse(resp *http.Response) (ChildResourcesClientListResponse, error) { + result := ChildResourcesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatusListResult); err != nil { + return ChildResourcesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/childresources_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/childresources_client_example_test.go new file mode 100644 index 000000000000..fcd3a5be3ed7 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/childresources_client_example_test.go @@ -0,0 +1,123 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json +func ExampleChildResourcesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewChildResourcesClient().NewListPager("resourceUri", &armresourcehealth.ChildResourcesClientListOptions{Filter: nil, + Expand: nil, + }) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AvailabilityStatusListResult = armresourcehealth.AvailabilityStatusListResult{ + // Value: []*armresourcehealth.AvailabilityStatus{ + // { + // Name: to.Ptr("rhctest_0"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/0/providers/Microsoft.ResourceHealth/child/availabilityStatuses/current"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:37:43Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), + // ReasonType: to.Ptr(""), + // ReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-04T01:18:25.575477Z"); return t}()), + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // }, + // { + // Name: to.Ptr("rhctest_3"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/3/providers/Microsoft.ResourceHealth/child/availabilityStatuses/current"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:37:41Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), + // ReasonType: to.Ptr(""), + // ReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-04T01:18:25.575477Z"); return t}()), + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // }, + // { + // Name: to.Ptr("rhctest_1"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/1/providers/Microsoft.ResourceHealth/child/availabilityStatuses/current"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:37:48Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), + // ReasonType: to.Ptr(""), + // ReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-04T01:18:25.575477Z"); return t}()), + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // }, + // { + // Name: to.Ptr("rhctest_2"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/2/providers/Microsoft.ResourceHealth/child/availabilityStatuses/current"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:37:43Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), + // ReasonType: to.Ptr(""), + // ReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-04T01:18:25.575477Z"); return t}()), + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // }, + // { + // Name: to.Ptr("rhctest_4"), + // Type: to.Ptr("Microsoft.ResourceHealth/AvailabilityStatuses"), + // ID: to.Ptr("/subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4/providers/Microsoft.ResourceHealth/child/availabilityStatuses/current"), + // Location: to.Ptr("southcentralus"), + // Properties: &armresourcehealth.AvailabilityStatusProperties{ + // AvailabilityState: to.Ptr(armresourcehealth.AvailabilityStateValuesAvailable), + // DetailedStatus: to.Ptr(""), + // OccurredTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-30T23:37:44Z"); return t}()), + // ReasonChronicity: to.Ptr(armresourcehealth.ReasonChronicityTypesPersistent), + // ReasonType: to.Ptr(""), + // ReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-04T01:18:25.575477Z"); return t}()), + // Summary: to.Ptr("There aren't any known Azure platform problems affecting this virtual machine"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/client_factory.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/client_factory.go index fcd069ba382c..b68aaf5e8540 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/client_factory.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/client_factory.go @@ -24,8 +24,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -48,3 +47,43 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } + +func (c *ClientFactory) NewMetadataClient() *MetadataClient { + subClient, _ := NewMetadataClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewImpactedResourcesClient() *ImpactedResourcesClient { + subClient, _ := NewImpactedResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSecurityAdvisoryImpactedResourcesClient() *SecurityAdvisoryImpactedResourcesClient { + subClient, _ := NewSecurityAdvisoryImpactedResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewEventsClient() *EventsClient { + subClient, _ := NewEventsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewEventClient() *EventClient { + subClient, _ := NewEventClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewChildAvailabilityStatusesClient() *ChildAvailabilityStatusesClient { + subClient, _ := NewChildAvailabilityStatusesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewChildResourcesClient() *ChildResourcesClient { + subClient, _ := NewChildResourcesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewEmergingIssuesClient() *EmergingIssuesClient { + subClient, _ := NewEmergingIssuesClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/constants.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/constants.go index 5d57d04fae40..efeb1e82c98b 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/constants.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/constants.go @@ -11,7 +11,7 @@ package armresourcehealth const ( moduleName = "armresourcehealth" - moduleVersion = "v1.1.0" + moduleVersion = "v1.2.0" ) // AvailabilityStateValues - Impacted resource status of the resource. @@ -34,6 +34,147 @@ func PossibleAvailabilityStateValuesValues() []AvailabilityStateValues { } } +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// EventLevelValues - Level of event. +type EventLevelValues string + +const ( + EventLevelValuesCritical EventLevelValues = "Critical" + EventLevelValuesError EventLevelValues = "Error" + EventLevelValuesInformational EventLevelValues = "Informational" + EventLevelValuesWarning EventLevelValues = "Warning" +) + +// PossibleEventLevelValuesValues returns the possible values for the EventLevelValues const type. +func PossibleEventLevelValuesValues() []EventLevelValues { + return []EventLevelValues{ + EventLevelValuesCritical, + EventLevelValuesError, + EventLevelValuesInformational, + EventLevelValuesWarning, + } +} + +// EventSourceValues - Source of event. +type EventSourceValues string + +const ( + EventSourceValuesResourceHealth EventSourceValues = "ResourceHealth" + EventSourceValuesServiceHealth EventSourceValues = "ServiceHealth" +) + +// PossibleEventSourceValuesValues returns the possible values for the EventSourceValues const type. +func PossibleEventSourceValuesValues() []EventSourceValues { + return []EventSourceValues{ + EventSourceValuesResourceHealth, + EventSourceValuesServiceHealth, + } +} + +// EventStatusValues - Current status of event. +type EventStatusValues string + +const ( + EventStatusValuesActive EventStatusValues = "Active" + EventStatusValuesResolved EventStatusValues = "Resolved" +) + +// PossibleEventStatusValuesValues returns the possible values for the EventStatusValues const type. +func PossibleEventStatusValuesValues() []EventStatusValues { + return []EventStatusValues{ + EventStatusValuesActive, + EventStatusValuesResolved, + } +} + +// EventTypeValues - Type of event. +type EventTypeValues string + +const ( + EventTypeValuesEmergingIssues EventTypeValues = "EmergingIssues" + EventTypeValuesHealthAdvisory EventTypeValues = "HealthAdvisory" + EventTypeValuesPlannedMaintenance EventTypeValues = "PlannedMaintenance" + EventTypeValuesRCA EventTypeValues = "RCA" + EventTypeValuesSecurityAdvisory EventTypeValues = "SecurityAdvisory" + EventTypeValuesServiceIssue EventTypeValues = "ServiceIssue" +) + +// PossibleEventTypeValuesValues returns the possible values for the EventTypeValues const type. +func PossibleEventTypeValuesValues() []EventTypeValues { + return []EventTypeValues{ + EventTypeValuesEmergingIssues, + EventTypeValuesHealthAdvisory, + EventTypeValuesPlannedMaintenance, + EventTypeValuesRCA, + EventTypeValuesSecurityAdvisory, + EventTypeValuesServiceIssue, + } +} + +type IssueNameParameter string + +const ( + IssueNameParameterDefault IssueNameParameter = "default" +) + +// PossibleIssueNameParameterValues returns the possible values for the IssueNameParameter const type. +func PossibleIssueNameParameterValues() []IssueNameParameter { + return []IssueNameParameter{ + IssueNameParameterDefault, + } +} + +// LevelValues - Level of insight. +type LevelValues string + +const ( + LevelValuesCritical LevelValues = "Critical" + LevelValuesWarning LevelValues = "Warning" +) + +// PossibleLevelValuesValues returns the possible values for the LevelValues const type. +func PossibleLevelValuesValues() []LevelValues { + return []LevelValues{ + LevelValuesCritical, + LevelValuesWarning, + } +} + +// LinkTypeValues - Type of link. +type LinkTypeValues string + +const ( + LinkTypeValuesButton LinkTypeValues = "Button" + LinkTypeValuesHyperlink LinkTypeValues = "Hyperlink" +) + +// PossibleLinkTypeValuesValues returns the possible values for the LinkTypeValues const type. +func PossibleLinkTypeValuesValues() []LinkTypeValues { + return []LinkTypeValues{ + LinkTypeValuesButton, + LinkTypeValuesHyperlink, + } +} + // ReasonChronicityTypes - Chronicity of the availability transition. type ReasonChronicityTypes string @@ -50,21 +191,51 @@ func PossibleReasonChronicityTypesValues() []ReasonChronicityTypes { } } -// ReasonTypeValues - When the resource's availabilityState is Unavailable, it describes where the health impacting event -// was originated. -type ReasonTypeValues string +type Scenario string + +const ( + ScenarioAlerts Scenario = "Alerts" +) + +// PossibleScenarioValues returns the possible values for the Scenario const type. +func PossibleScenarioValues() []Scenario { + return []Scenario{ + ScenarioAlerts, + } +} + +// SeverityValues - The severity level of this active event. +type SeverityValues string + +const ( + SeverityValuesError SeverityValues = "Error" + SeverityValuesInformation SeverityValues = "Information" + SeverityValuesWarning SeverityValues = "Warning" +) + +// PossibleSeverityValuesValues returns the possible values for the SeverityValues const type. +func PossibleSeverityValuesValues() []SeverityValues { + return []SeverityValues{ + SeverityValuesError, + SeverityValuesInformation, + SeverityValuesWarning, + } +} + +// StageValues - The stage of this active event. +type StageValues string const ( - ReasonTypeValuesPlanned ReasonTypeValues = "Planned" - ReasonTypeValuesUnplanned ReasonTypeValues = "Unplanned" - ReasonTypeValuesUserInitiated ReasonTypeValues = "UserInitiated" + StageValuesActive StageValues = "Active" + StageValuesArchived StageValues = "Archived" + StageValuesResolve StageValues = "Resolve" ) -// PossibleReasonTypeValuesValues returns the possible values for the ReasonTypeValues const type. -func PossibleReasonTypeValuesValues() []ReasonTypeValues { - return []ReasonTypeValues{ - ReasonTypeValuesPlanned, - ReasonTypeValuesUnplanned, - ReasonTypeValuesUserInitiated, +// PossibleStageValuesValues returns the possible values for the StageValues const type. +func PossibleStageValuesValues() []StageValues { + return []StageValues{ + StageValuesActive, + StageValuesArchived, + StageValuesResolve, } } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/emergingissues_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/emergingissues_client.go new file mode 100644 index 000000000000..0bba66ca3517 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/emergingissues_client.go @@ -0,0 +1,145 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// EmergingIssuesClient contains the methods for the EmergingIssues group. +// Don't use this type directly, use NewEmergingIssuesClient() instead. +type EmergingIssuesClient struct { + internal *arm.Client +} + +// NewEmergingIssuesClient creates a new instance of EmergingIssuesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEmergingIssuesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EmergingIssuesClient, error) { + cl, err := arm.NewClient(moduleName+".EmergingIssuesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EmergingIssuesClient{ + internal: cl, + } + return client, nil +} + +// Get - Gets Azure services' emerging issues. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - issueName - The name of the emerging issue. +// - options - EmergingIssuesClientGetOptions contains the optional parameters for the EmergingIssuesClient.Get method. +func (client *EmergingIssuesClient) Get(ctx context.Context, issueName IssueNameParameter, options *EmergingIssuesClientGetOptions) (EmergingIssuesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, issueName, options) + if err != nil { + return EmergingIssuesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmergingIssuesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EmergingIssuesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *EmergingIssuesClient) getCreateRequest(ctx context.Context, issueName IssueNameParameter, options *EmergingIssuesClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}" + if issueName == "" { + return nil, errors.New("parameter issueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{issueName}", url.PathEscape(string(issueName))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EmergingIssuesClient) getHandleResponse(resp *http.Response) (EmergingIssuesClientGetResponse, error) { + result := EmergingIssuesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmergingIssuesGetResult); err != nil { + return EmergingIssuesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists Azure services' emerging issues. +// +// Generated from API version 2022-10-01 +// - options - EmergingIssuesClientListOptions contains the optional parameters for the EmergingIssuesClient.NewListPager method. +func (client *EmergingIssuesClient) NewListPager(options *EmergingIssuesClientListOptions) *runtime.Pager[EmergingIssuesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[EmergingIssuesClientListResponse]{ + More: func(page EmergingIssuesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmergingIssuesClientListResponse) (EmergingIssuesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return EmergingIssuesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmergingIssuesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EmergingIssuesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *EmergingIssuesClient) listCreateRequest(ctx context.Context, options *EmergingIssuesClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/emergingIssues" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *EmergingIssuesClient) listHandleResponse(resp *http.Response) (EmergingIssuesClientListResponse, error) { + result := EmergingIssuesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmergingIssueListResult); err != nil { + return EmergingIssuesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/emergingissues_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/emergingissues_client_example_test.go new file mode 100644 index 000000000000..556a949739ef --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/emergingissues_client_example_test.go @@ -0,0 +1,202 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json +func ExampleEmergingIssuesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmergingIssuesClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.EmergingIssueListResult = armresourcehealth.EmergingIssueListResult{ + // Value: []*armresourcehealth.EmergingIssuesGetResult{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/emergingissues"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/emergingissues/default"), + // Properties: &armresourcehealth.EmergingIssue{ + // RefreshTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-17T09:12:00Z"); return t}()), + // StatusActiveEvents: []*armresourcehealth.StatusActiveEvent{ + // { + // Description: to.Ptr("Virtual Machines case"), + // Cloud: to.Ptr("Public"), + // Impacts: []*armresourcehealth.EmergingIssueImpact{ + // { + // Name: to.Ptr("Virtual Machines"), + // ID: to.Ptr("virtual-machines"), + // Regions: []*armresourcehealth.ImpactedRegion{ + // { + // Name: to.Ptr("Central US"), + // ID: to.Ptr("us-central"), + // }, + // { + // Name: to.Ptr("East US"), + // ID: to.Ptr("us-east"), + // }}, + // }}, + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-15T08:10:00Z"); return t}()), + // Published: to.Ptr(true), + // Severity: to.Ptr(armresourcehealth.SeverityValuesInformation), + // Stage: to.Ptr(armresourcehealth.StageValuesActive), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-15T08:06:00Z"); return t}()), + // Title: to.Ptr("Automatic updates to the dial tone page from ACM - SHD event"), + // TrackingID: to.Ptr("KTTK-TZ8"), + // }, + // { + // Description: to.Ptr("All Azure SQL service management requests (create, update, delete, etc.) are serviced through the SQL Control Plane infrastructure. Engineers determined that during this issue, the control plane service became unhealthy after receiving a significant increase in internally generated operations and reaching an operational threshold. This led to service management requests becoming unable to complete, which in-turn resulted in timeouts and throttling. Subsequent investigation by engineers determined this issue was due service requests from an internal Azure group that triggered a bug which caused an excessive number of internally generated operations."), + // Cloud: to.Ptr("Public"), + // Impacts: []*armresourcehealth.EmergingIssueImpact{ + // { + // Name: to.Ptr("SQL Database"), + // ID: to.Ptr("sql-database"), + // Regions: []*armresourcehealth.ImpactedRegion{ + // { + // Name: to.Ptr("West Europe"), + // ID: to.Ptr("europe-west"), + // }}, + // }}, + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-16T05:11:00Z"); return t}()), + // Published: to.Ptr(true), + // Severity: to.Ptr(armresourcehealth.SeverityValuesError), + // Stage: to.Ptr(armresourcehealth.StageValuesActive), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-16T05:11:00Z"); return t}()), + // Title: to.Ptr("Azure SQL Database - West Europe"), + // TrackingID: to.Ptr("4KHK-LS8"), + // }}, + // StatusBanners: []*armresourcehealth.StatusBanner{ + // { + // Cloud: to.Ptr("Public"), + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-15T08:04:00Z"); return t}()), + // Message: to.Ptr("Testing backup site"), + // Title: to.Ptr("Automatic updates to the dial tone page from ACM - banner"), + // }, + // { + // Cloud: to.Ptr("Public"), + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-15T10:15:00Z"); return t}()), + // Message: to.Ptr("A subset of customers using Storage in West Europe experienced service availability issues. In addition, resources with dependencies on the impacted storage scale units may have experienced downstream impact in the form of availability issues, connection failures, or high latency. Engineers are investigating the root cause."), + // Title: to.Ptr("Storage - West Europe"), + // }}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json +func ExampleEmergingIssuesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmergingIssuesClient().Get(ctx, armresourcehealth.IssueNameParameterDefault, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.EmergingIssuesGetResult = armresourcehealth.EmergingIssuesGetResult{ + // Name: to.Ptr("default"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/emergingissues"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/emergingissues/default"), + // Properties: &armresourcehealth.EmergingIssue{ + // RefreshTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-17T09:12:00Z"); return t}()), + // StatusActiveEvents: []*armresourcehealth.StatusActiveEvent{ + // { + // Description: to.Ptr("Virtual Machines case"), + // Cloud: to.Ptr("Public"), + // Impacts: []*armresourcehealth.EmergingIssueImpact{ + // { + // Name: to.Ptr("Virtual Machines"), + // ID: to.Ptr("virtual-machines"), + // Regions: []*armresourcehealth.ImpactedRegion{ + // { + // Name: to.Ptr("Central US"), + // ID: to.Ptr("us-central"), + // }, + // { + // Name: to.Ptr("East US"), + // ID: to.Ptr("us-east"), + // }}, + // }}, + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-15T08:10:00Z"); return t}()), + // Published: to.Ptr(true), + // Severity: to.Ptr(armresourcehealth.SeverityValuesInformation), + // Stage: to.Ptr(armresourcehealth.StageValuesActive), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-15T08:06:00Z"); return t}()), + // Title: to.Ptr("Automatic updates to the dial tone page from ACM - SHD event"), + // TrackingID: to.Ptr("KTTK-TZ8"), + // }, + // { + // Description: to.Ptr("All Azure SQL service management requests (create, update, delete, etc.) are serviced through the SQL Control Plane infrastructure. Engineers determined that during this issue, the control plane service became unhealthy after receiving a significant increase in internally generated operations and reaching an operational threshold. This led to service management requests becoming unable to complete, which in-turn resulted in timeouts and throttling. Subsequent investigation by engineers determined this issue was due service requests from an internal Azure group that triggered a bug which caused an excessive number of internally generated operations."), + // Cloud: to.Ptr("Public"), + // Impacts: []*armresourcehealth.EmergingIssueImpact{ + // { + // Name: to.Ptr("SQL Database"), + // ID: to.Ptr("sql-database"), + // Regions: []*armresourcehealth.ImpactedRegion{ + // { + // Name: to.Ptr("West Europe"), + // ID: to.Ptr("europe-west"), + // }}, + // }}, + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-16T05:11:00Z"); return t}()), + // Published: to.Ptr(true), + // Severity: to.Ptr(armresourcehealth.SeverityValuesError), + // Stage: to.Ptr(armresourcehealth.StageValuesActive), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-16T05:11:00Z"); return t}()), + // Title: to.Ptr("Azure SQL Database - West Europe"), + // TrackingID: to.Ptr("4KHK-LS8"), + // }}, + // StatusBanners: []*armresourcehealth.StatusBanner{ + // { + // Cloud: to.Ptr("Public"), + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-15T08:04:00Z"); return t}()), + // Message: to.Ptr("Testing backup site"), + // Title: to.Ptr("Automatic updates to the dial tone page from ACM - banner"), + // }, + // { + // Cloud: to.Ptr("Public"), + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-15T10:15:00Z"); return t}()), + // Message: to.Ptr("A subset of customers using Storage in West Europe experienced service availability issues. In addition, resources with dependencies on the impacted storage scale units may have experienced downstream impact in the form of availability issues, connection failures, or high latency. Engineers are investigating the root cause."), + // Title: to.Ptr("Storage - West Europe"), + // }}, + // }, + // } +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/event_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/event_client.go new file mode 100644 index 000000000000..e73ae2b5e2de --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/event_client.go @@ -0,0 +1,263 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// EventClient contains the methods for the Event group. +// Don't use this type directly, use NewEventClient() instead. +type EventClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEventClient creates a new instance of EventClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEventClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EventClient, error) { + cl, err := arm.NewClient(moduleName+".EventClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EventClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// FetchDetailsBySubscriptionIDAndTrackingID - Service health event details in the subscription by event tracking id. This +// can be used to fetch sensitive properties for Security Advisory events +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - options - EventClientFetchDetailsBySubscriptionIDAndTrackingIDOptions contains the optional parameters for the EventClient.FetchDetailsBySubscriptionIDAndTrackingID +// method. +func (client *EventClient) FetchDetailsBySubscriptionIDAndTrackingID(ctx context.Context, eventTrackingID string, options *EventClientFetchDetailsBySubscriptionIDAndTrackingIDOptions) (EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse, error) { + req, err := client.fetchDetailsBySubscriptionIDAndTrackingIDCreateRequest(ctx, eventTrackingID, options) + if err != nil { + return EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse{}, runtime.NewResponseError(resp) + } + return client.fetchDetailsBySubscriptionIDAndTrackingIDHandleResponse(resp) +} + +// fetchDetailsBySubscriptionIDAndTrackingIDCreateRequest creates the FetchDetailsBySubscriptionIDAndTrackingID request. +func (client *EventClient) fetchDetailsBySubscriptionIDAndTrackingIDCreateRequest(ctx context.Context, eventTrackingID string, options *EventClientFetchDetailsBySubscriptionIDAndTrackingIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// fetchDetailsBySubscriptionIDAndTrackingIDHandleResponse handles the FetchDetailsBySubscriptionIDAndTrackingID response. +func (client *EventClient) fetchDetailsBySubscriptionIDAndTrackingIDHandleResponse(resp *http.Response) (EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse, error) { + result := EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Event); err != nil { + return EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse{}, err + } + return result, nil +} + +// FetchDetailsByTenantIDAndTrackingID - Service health event details in the tenant by event tracking id. This can be used +// to fetch sensitive properties for Security Advisory events +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - options - EventClientFetchDetailsByTenantIDAndTrackingIDOptions contains the optional parameters for the EventClient.FetchDetailsByTenantIDAndTrackingID +// method. +func (client *EventClient) FetchDetailsByTenantIDAndTrackingID(ctx context.Context, eventTrackingID string, options *EventClientFetchDetailsByTenantIDAndTrackingIDOptions) (EventClientFetchDetailsByTenantIDAndTrackingIDResponse, error) { + req, err := client.fetchDetailsByTenantIDAndTrackingIDCreateRequest(ctx, eventTrackingID, options) + if err != nil { + return EventClientFetchDetailsByTenantIDAndTrackingIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EventClientFetchDetailsByTenantIDAndTrackingIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EventClientFetchDetailsByTenantIDAndTrackingIDResponse{}, runtime.NewResponseError(resp) + } + return client.fetchDetailsByTenantIDAndTrackingIDHandleResponse(resp) +} + +// fetchDetailsByTenantIDAndTrackingIDCreateRequest creates the FetchDetailsByTenantIDAndTrackingID request. +func (client *EventClient) fetchDetailsByTenantIDAndTrackingIDCreateRequest(ctx context.Context, eventTrackingID string, options *EventClientFetchDetailsByTenantIDAndTrackingIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// fetchDetailsByTenantIDAndTrackingIDHandleResponse handles the FetchDetailsByTenantIDAndTrackingID response. +func (client *EventClient) fetchDetailsByTenantIDAndTrackingIDHandleResponse(resp *http.Response) (EventClientFetchDetailsByTenantIDAndTrackingIDResponse, error) { + result := EventClientFetchDetailsByTenantIDAndTrackingIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Event); err != nil { + return EventClientFetchDetailsByTenantIDAndTrackingIDResponse{}, err + } + return result, nil +} + +// GetBySubscriptionIDAndTrackingID - Service health event in the subscription by event tracking id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - options - EventClientGetBySubscriptionIDAndTrackingIDOptions contains the optional parameters for the EventClient.GetBySubscriptionIDAndTrackingID +// method. +func (client *EventClient) GetBySubscriptionIDAndTrackingID(ctx context.Context, eventTrackingID string, options *EventClientGetBySubscriptionIDAndTrackingIDOptions) (EventClientGetBySubscriptionIDAndTrackingIDResponse, error) { + req, err := client.getBySubscriptionIDAndTrackingIDCreateRequest(ctx, eventTrackingID, options) + if err != nil { + return EventClientGetBySubscriptionIDAndTrackingIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EventClientGetBySubscriptionIDAndTrackingIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EventClientGetBySubscriptionIDAndTrackingIDResponse{}, runtime.NewResponseError(resp) + } + return client.getBySubscriptionIDAndTrackingIDHandleResponse(resp) +} + +// getBySubscriptionIDAndTrackingIDCreateRequest creates the GetBySubscriptionIDAndTrackingID request. +func (client *EventClient) getBySubscriptionIDAndTrackingIDCreateRequest(ctx context.Context, eventTrackingID string, options *EventClientGetBySubscriptionIDAndTrackingIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.QueryStartTime != nil { + reqQP.Set("queryStartTime", *options.QueryStartTime) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getBySubscriptionIDAndTrackingIDHandleResponse handles the GetBySubscriptionIDAndTrackingID response. +func (client *EventClient) getBySubscriptionIDAndTrackingIDHandleResponse(resp *http.Response) (EventClientGetBySubscriptionIDAndTrackingIDResponse, error) { + result := EventClientGetBySubscriptionIDAndTrackingIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Event); err != nil { + return EventClientGetBySubscriptionIDAndTrackingIDResponse{}, err + } + return result, nil +} + +// GetByTenantIDAndTrackingID - Service health event in the tenant by event tracking id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - options - EventClientGetByTenantIDAndTrackingIDOptions contains the optional parameters for the EventClient.GetByTenantIDAndTrackingID +// method. +func (client *EventClient) GetByTenantIDAndTrackingID(ctx context.Context, eventTrackingID string, options *EventClientGetByTenantIDAndTrackingIDOptions) (EventClientGetByTenantIDAndTrackingIDResponse, error) { + req, err := client.getByTenantIDAndTrackingIDCreateRequest(ctx, eventTrackingID, options) + if err != nil { + return EventClientGetByTenantIDAndTrackingIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EventClientGetByTenantIDAndTrackingIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EventClientGetByTenantIDAndTrackingIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByTenantIDAndTrackingIDHandleResponse(resp) +} + +// getByTenantIDAndTrackingIDCreateRequest creates the GetByTenantIDAndTrackingID request. +func (client *EventClient) getByTenantIDAndTrackingIDCreateRequest(ctx context.Context, eventTrackingID string, options *EventClientGetByTenantIDAndTrackingIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.QueryStartTime != nil { + reqQP.Set("queryStartTime", *options.QueryStartTime) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByTenantIDAndTrackingIDHandleResponse handles the GetByTenantIDAndTrackingID response. +func (client *EventClient) getByTenantIDAndTrackingIDHandleResponse(resp *http.Response) (EventClientGetByTenantIDAndTrackingIDResponse, error) { + result := EventClientGetByTenantIDAndTrackingIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Event); err != nil { + return EventClientGetByTenantIDAndTrackingIDResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/event_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/event_client_example_test.go new file mode 100644 index 000000000000..077f510e21e0 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/event_client_example_test.go @@ -0,0 +1,443 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json +func ExampleEventClient_GetBySubscriptionIDAndTrackingID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEventClient().GetBySubscriptionIDAndTrackingID(ctx, "eventTrackingId", &armresourcehealth.EventClientGetBySubscriptionIDAndTrackingIDOptions{Filter: to.Ptr("properties/status eq 'Active'"), + QueryStartTime: to.Ptr("7/10/2022"), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Event = armresourcehealth.Event{ + // Name: to.Ptr("{eventTrackingId}"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/events"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"), + // Properties: &armresourcehealth.EventProperties{ + // Article: &armresourcehealth.EventPropertiesArticle{ + // ArticleContent: to.Ptr("An outage alert is being investigated. More information will be provided as it is known"), + // }, + // EnableChatWithUs: to.Ptr(false), + // EnableMicrosoftSupport: to.Ptr(true), + // EventLevel: to.Ptr(armresourcehealth.EventLevelValuesInformational), + // EventSource: to.Ptr(armresourcehealth.EventSourceValuesResourceHealth), + // EventType: to.Ptr(armresourcehealth.EventTypeValuesServiceIssue), + // Faqs: []*armresourcehealth.Faq{ + // { + // Answer: to.Ptr("This is an answer"), + // LocaleCode: to.Ptr("en"), + // Question: to.Ptr("This is a question"), + // }}, + // Header: to.Ptr("Your service might have been impacted by an Azure service issue"), + // HirStage: to.Ptr("resolved"), + // Impact: []*armresourcehealth.Impact{ + // { + // ImpactedRegions: []*armresourcehealth.ImpactedServiceRegion{ + // { + // ImpactedRegion: to.Ptr("West US"), + // ImpactedSubscriptions: []*string{ + // to.Ptr("{subscriptionId}")}, + // ImpactedTenants: []*string{ + // }, + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T21:05:00Z"); return t}()), + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // }}, + // ImpactedService: to.Ptr("Virtual Machines"), + // }}, + // ImpactMitigationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // ImpactStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), + // IsHIR: to.Ptr(false), + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // Level: to.Ptr(armresourcehealth.LevelValuesWarning), + // Links: []*armresourcehealth.Link{ + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesHyperlink), + // BladeName: to.Ptr("RequestRCABlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Request RCA"), + // Value: to.Ptr("Request RCA"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "rcaRequested": "False", + // "trackingId": "{eventTrackingId}", + // }, + // }, + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesButton), + // BladeName: to.Ptr("AzureHealthBrowseBlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Sign up for updates"), + // Value: to.Ptr("Sign up for updates"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "trackingId": "{eventTrackingId}", + // }, + // }}, + // Priority: to.Ptr[int32](2), + // RecommendedActions: &armresourcehealth.EventPropertiesRecommendedActions{ + // Actions: []*armresourcehealth.EventPropertiesRecommendedActionsItem{ + // { + // ActionText: to.Ptr("action 1"), + // GroupID: to.Ptr[int32](23243), + // }, + // { + // ActionText: to.Ptr("action 2"), + // GroupID: to.Ptr[int32](23432), + // }}, + // LocaleCode: to.Ptr("en"), + // Message: to.Ptr("Recommended actions title"), + // }, + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // Summary: to.Ptr("An outage alert is being investigated. More information will be provided as it is known."), + // Title: to.Ptr("ACTIVE: Virtual machines in West US"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json +func ExampleEventClient_FetchDetailsBySubscriptionIDAndTrackingID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEventClient().FetchDetailsBySubscriptionIDAndTrackingID(ctx, "eventTrackingId", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Event = armresourcehealth.Event{ + // Name: to.Ptr("{eventTrackingId}"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/events"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"), + // Properties: &armresourcehealth.EventProperties{ + // Article: &armresourcehealth.EventPropertiesArticle{ + // ArticleContent: to.Ptr("An outage alert is being investigated. More information will be provided as it is known"), + // }, + // EnableChatWithUs: to.Ptr(false), + // EnableMicrosoftSupport: to.Ptr(true), + // EventLevel: to.Ptr(armresourcehealth.EventLevelValuesInformational), + // EventSource: to.Ptr(armresourcehealth.EventSourceValuesResourceHealth), + // EventType: to.Ptr(armresourcehealth.EventTypeValuesServiceIssue), + // Faqs: []*armresourcehealth.Faq{ + // { + // Answer: to.Ptr("This is an answer"), + // LocaleCode: to.Ptr("en"), + // Question: to.Ptr("This is a question"), + // }}, + // Header: to.Ptr("Your service might have been impacted by an Azure service issue"), + // HirStage: to.Ptr("resolved"), + // Impact: []*armresourcehealth.Impact{ + // { + // ImpactedRegions: []*armresourcehealth.ImpactedServiceRegion{ + // { + // ImpactedRegion: to.Ptr("West US"), + // ImpactedSubscriptions: []*string{ + // to.Ptr("{subscriptionId}")}, + // ImpactedTenants: []*string{ + // }, + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T21:05:00Z"); return t}()), + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // }}, + // ImpactedService: to.Ptr("Virtual Machines"), + // }}, + // ImpactMitigationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // ImpactStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), + // IsHIR: to.Ptr(false), + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // Level: to.Ptr(armresourcehealth.LevelValuesWarning), + // Links: []*armresourcehealth.Link{ + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesHyperlink), + // BladeName: to.Ptr("RequestRCABlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Request RCA"), + // Value: to.Ptr("Request RCA"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "rcaRequested": "False", + // "trackingId": "{eventTrackingId}", + // }, + // }, + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesButton), + // BladeName: to.Ptr("AzureHealthBrowseBlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Sign up for updates"), + // Value: to.Ptr("Sign up for updates"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "trackingId": "{eventTrackingId}", + // }, + // }}, + // Priority: to.Ptr[int32](2), + // RecommendedActions: &armresourcehealth.EventPropertiesRecommendedActions{ + // Actions: []*armresourcehealth.EventPropertiesRecommendedActionsItem{ + // { + // ActionText: to.Ptr("action 1"), + // GroupID: to.Ptr[int32](23243), + // }, + // { + // ActionText: to.Ptr("action 2"), + // GroupID: to.Ptr[int32](23432), + // }}, + // LocaleCode: to.Ptr("en"), + // Message: to.Ptr("Recommended actions title"), + // }, + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // Summary: to.Ptr("An outage alert is being investigated. More information will be provided as it is known."), + // Title: to.Ptr("ACTIVE: Virtual machines in West US"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json +func ExampleEventClient_GetByTenantIDAndTrackingID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEventClient().GetByTenantIDAndTrackingID(ctx, "eventTrackingId", &armresourcehealth.EventClientGetByTenantIDAndTrackingIDOptions{Filter: to.Ptr("properties/status eq 'Active'"), + QueryStartTime: to.Ptr("7/10/2022"), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Event = armresourcehealth.Event{ + // Name: to.Ptr("{eventTrackingId}"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/events"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"), + // Properties: &armresourcehealth.EventProperties{ + // Article: &armresourcehealth.EventPropertiesArticle{ + // ArticleContent: to.Ptr("An outage alert is being investigated. More information will be provided as it is known"), + // }, + // EnableChatWithUs: to.Ptr(false), + // EnableMicrosoftSupport: to.Ptr(true), + // EventLevel: to.Ptr(armresourcehealth.EventLevelValuesInformational), + // EventSource: to.Ptr(armresourcehealth.EventSourceValuesResourceHealth), + // EventType: to.Ptr(armresourcehealth.EventTypeValuesServiceIssue), + // Faqs: []*armresourcehealth.Faq{ + // { + // Answer: to.Ptr("This is an answer"), + // LocaleCode: to.Ptr("en"), + // Question: to.Ptr("This is a question"), + // }}, + // Header: to.Ptr("Your service might have been impacted by an Azure service issue"), + // HirStage: to.Ptr("resolved"), + // Impact: []*armresourcehealth.Impact{ + // { + // ImpactedRegions: []*armresourcehealth.ImpactedServiceRegion{ + // { + // ImpactedRegion: to.Ptr("West US"), + // ImpactedSubscriptions: []*string{ + // }, + // ImpactedTenants: []*string{ + // to.Ptr("00000000-0000-0000-0000-000000000000")}, + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T21:05:00Z"); return t}()), + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // }}, + // ImpactedService: to.Ptr("Virtual Machines"), + // }}, + // ImpactMitigationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // ImpactStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), + // IsHIR: to.Ptr(false), + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // Level: to.Ptr(armresourcehealth.LevelValuesWarning), + // Links: []*armresourcehealth.Link{ + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesHyperlink), + // BladeName: to.Ptr("RequestRCABlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Request RCA"), + // Value: to.Ptr("Request RCA"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "rcaRequested": "False", + // "trackingId": "{eventTrackingId}", + // }, + // }, + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesButton), + // BladeName: to.Ptr("AzureHealthBrowseBlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Sign up for updates"), + // Value: to.Ptr("Sign up for updates"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "trackingId": "{eventTrackingId}", + // }, + // }}, + // Priority: to.Ptr[int32](2), + // RecommendedActions: &armresourcehealth.EventPropertiesRecommendedActions{ + // Actions: []*armresourcehealth.EventPropertiesRecommendedActionsItem{ + // { + // ActionText: to.Ptr("action 1"), + // GroupID: to.Ptr[int32](23243), + // }, + // { + // ActionText: to.Ptr("action 2"), + // GroupID: to.Ptr[int32](23432), + // }}, + // LocaleCode: to.Ptr("en"), + // Message: to.Ptr("Recommended actions title"), + // }, + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // Summary: to.Ptr("An outage alert is being investigated. More information will be provided as it is known."), + // Title: to.Ptr("ACTIVE: Virtual machines in West US"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json +func ExampleEventClient_FetchDetailsByTenantIDAndTrackingID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEventClient().FetchDetailsByTenantIDAndTrackingID(ctx, "eventTrackingId", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Event = armresourcehealth.Event{ + // Name: to.Ptr("{eventTrackingId}"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/events"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"), + // Properties: &armresourcehealth.EventProperties{ + // Article: &armresourcehealth.EventPropertiesArticle{ + // ArticleContent: to.Ptr("An outage alert is being investigated. More information will be provided as it is known"), + // }, + // EnableChatWithUs: to.Ptr(false), + // EnableMicrosoftSupport: to.Ptr(true), + // EventLevel: to.Ptr(armresourcehealth.EventLevelValuesInformational), + // EventSource: to.Ptr(armresourcehealth.EventSourceValuesResourceHealth), + // EventType: to.Ptr(armresourcehealth.EventTypeValuesServiceIssue), + // Faqs: []*armresourcehealth.Faq{ + // { + // Answer: to.Ptr("This is an answer"), + // LocaleCode: to.Ptr("en"), + // Question: to.Ptr("This is a question"), + // }}, + // Header: to.Ptr("Your service might have been impacted by an Azure service issue"), + // HirStage: to.Ptr("resolved"), + // Impact: []*armresourcehealth.Impact{ + // { + // ImpactedRegions: []*armresourcehealth.ImpactedServiceRegion{ + // { + // ImpactedRegion: to.Ptr("West US"), + // ImpactedSubscriptions: []*string{ + // }, + // ImpactedTenants: []*string{ + // to.Ptr("00000000-0000-0000-0000-000000000000")}, + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T21:05:00Z"); return t}()), + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // }}, + // ImpactedService: to.Ptr("Virtual Machines"), + // }}, + // ImpactMitigationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // ImpactStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), + // IsHIR: to.Ptr(false), + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // Level: to.Ptr(armresourcehealth.LevelValuesWarning), + // Links: []*armresourcehealth.Link{ + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesHyperlink), + // BladeName: to.Ptr("RequestRCABlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Request RCA"), + // Value: to.Ptr("Request RCA"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "rcaRequested": "False", + // "trackingId": "{eventTrackingId}", + // }, + // }, + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesButton), + // BladeName: to.Ptr("AzureHealthBrowseBlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Sign up for updates"), + // Value: to.Ptr("Sign up for updates"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "trackingId": "{eventTrackingId}", + // }, + // }}, + // Priority: to.Ptr[int32](2), + // RecommendedActions: &armresourcehealth.EventPropertiesRecommendedActions{ + // Actions: []*armresourcehealth.EventPropertiesRecommendedActionsItem{ + // { + // ActionText: to.Ptr("action 1"), + // GroupID: to.Ptr[int32](23243), + // }, + // { + // ActionText: to.Ptr("action 2"), + // GroupID: to.Ptr[int32](23432), + // }}, + // LocaleCode: to.Ptr("en"), + // Message: to.Ptr("Recommended actions title"), + // }, + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // Summary: to.Ptr("An outage alert is being investigated. More information will be provided as it is known."), + // Title: to.Ptr("ACTIVE: Virtual machines in West US"), + // }, + // } +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/events_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/events_client.go new file mode 100644 index 000000000000..58a6b5145344 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/events_client.go @@ -0,0 +1,238 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// EventsClient contains the methods for the Events group. +// Don't use this type directly, use NewEventsClient() instead. +type EventsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEventsClient creates a new instance of EventsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEventsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EventsClient, error) { + cl, err := arm.NewClient(moduleName+".EventsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EventsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListBySingleResourcePager - Lists current service health events for given resource. +// +// Generated from API version 2022-10-01 +// - 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} +// - options - EventsClientListBySingleResourceOptions contains the optional parameters for the EventsClient.NewListBySingleResourcePager +// method. +func (client *EventsClient) NewListBySingleResourcePager(resourceURI string, options *EventsClientListBySingleResourceOptions) *runtime.Pager[EventsClientListBySingleResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[EventsClientListBySingleResourceResponse]{ + More: func(page EventsClientListBySingleResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EventsClientListBySingleResourceResponse) (EventsClientListBySingleResourceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySingleResourceCreateRequest(ctx, resourceURI, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return EventsClientListBySingleResourceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EventsClientListBySingleResourceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EventsClientListBySingleResourceResponse{}, runtime.NewResponseError(resp) + } + return client.listBySingleResourceHandleResponse(resp) + }, + }) +} + +// listBySingleResourceCreateRequest creates the ListBySingleResource request. +func (client *EventsClient) listBySingleResourceCreateRequest(ctx context.Context, resourceURI string, options *EventsClientListBySingleResourceOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/events" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySingleResourceHandleResponse handles the ListBySingleResource response. +func (client *EventsClient) listBySingleResourceHandleResponse(resp *http.Response) (EventsClientListBySingleResourceResponse, error) { + result := EventsClientListBySingleResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Events); err != nil { + return EventsClientListBySingleResourceResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionIDPager - Lists service health events in the subscription. +// +// Generated from API version 2022-10-01 +// - options - EventsClientListBySubscriptionIDOptions contains the optional parameters for the EventsClient.NewListBySubscriptionIDPager +// method. +func (client *EventsClient) NewListBySubscriptionIDPager(options *EventsClientListBySubscriptionIDOptions) *runtime.Pager[EventsClientListBySubscriptionIDResponse] { + return runtime.NewPager(runtime.PagingHandler[EventsClientListBySubscriptionIDResponse]{ + More: func(page EventsClientListBySubscriptionIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EventsClientListBySubscriptionIDResponse) (EventsClientListBySubscriptionIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionIDCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return EventsClientListBySubscriptionIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EventsClientListBySubscriptionIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EventsClientListBySubscriptionIDResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionIDHandleResponse(resp) + }, + }) +} + +// listBySubscriptionIDCreateRequest creates the ListBySubscriptionID request. +func (client *EventsClient) listBySubscriptionIDCreateRequest(ctx context.Context, options *EventsClientListBySubscriptionIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.QueryStartTime != nil { + reqQP.Set("queryStartTime", *options.QueryStartTime) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionIDHandleResponse handles the ListBySubscriptionID response. +func (client *EventsClient) listBySubscriptionIDHandleResponse(resp *http.Response) (EventsClientListBySubscriptionIDResponse, error) { + result := EventsClientListBySubscriptionIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Events); err != nil { + return EventsClientListBySubscriptionIDResponse{}, err + } + return result, nil +} + +// NewListByTenantIDPager - Lists current service health events in the tenant. +// +// Generated from API version 2022-10-01 +// - options - EventsClientListByTenantIDOptions contains the optional parameters for the EventsClient.NewListByTenantIDPager +// method. +func (client *EventsClient) NewListByTenantIDPager(options *EventsClientListByTenantIDOptions) *runtime.Pager[EventsClientListByTenantIDResponse] { + return runtime.NewPager(runtime.PagingHandler[EventsClientListByTenantIDResponse]{ + More: func(page EventsClientListByTenantIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EventsClientListByTenantIDResponse) (EventsClientListByTenantIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByTenantIDCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return EventsClientListByTenantIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EventsClientListByTenantIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EventsClientListByTenantIDResponse{}, runtime.NewResponseError(resp) + } + return client.listByTenantIDHandleResponse(resp) + }, + }) +} + +// listByTenantIDCreateRequest creates the ListByTenantID request. +func (client *EventsClient) listByTenantIDCreateRequest(ctx context.Context, options *EventsClientListByTenantIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/events" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.QueryStartTime != nil { + reqQP.Set("queryStartTime", *options.QueryStartTime) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTenantIDHandleResponse handles the ListByTenantID response. +func (client *EventsClient) listByTenantIDHandleResponse(resp *http.Response) (EventsClientListByTenantIDResponse, error) { + result := EventsClientListByTenantIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Events); err != nil { + return EventsClientListByTenantIDResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/events_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/events_client_example_test.go new file mode 100644 index 000000000000..a78e5323fb73 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/events_client_example_test.go @@ -0,0 +1,360 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json +func ExampleEventsClient_NewListBySubscriptionIDPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEventsClient().NewListBySubscriptionIDPager(&armresourcehealth.EventsClientListBySubscriptionIDOptions{Filter: to.Ptr("service eq 'Virtual Machines' or region eq 'West US'"), + QueryStartTime: to.Ptr("7/24/2020"), + }) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.Events = armresourcehealth.Events{ + // Value: []*armresourcehealth.Event{ + // { + // Name: to.Ptr("BC_1-FXZ"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/events"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/BC_1-FXZ"), + // Properties: &armresourcehealth.EventProperties{ + // Article: &armresourcehealth.EventPropertiesArticle{ + // ArticleContent: to.Ptr("An outage alert is being investigated. More information will be provided as it is known"), + // }, + // EnableChatWithUs: to.Ptr(false), + // EnableMicrosoftSupport: to.Ptr(true), + // EventLevel: to.Ptr(armresourcehealth.EventLevelValuesInformational), + // EventSource: to.Ptr(armresourcehealth.EventSourceValuesResourceHealth), + // EventType: to.Ptr(armresourcehealth.EventTypeValuesServiceIssue), + // Faqs: []*armresourcehealth.Faq{ + // { + // Answer: to.Ptr("This is an answer"), + // LocaleCode: to.Ptr("en"), + // Question: to.Ptr("This is a question"), + // }}, + // Header: to.Ptr("Your service might have been impacted by an Azure service issue"), + // HirStage: to.Ptr("resolved"), + // Impact: []*armresourcehealth.Impact{ + // { + // ImpactedRegions: []*armresourcehealth.ImpactedServiceRegion{ + // { + // ImpactedRegion: to.Ptr("West US"), + // ImpactedSubscriptions: []*string{ + // to.Ptr("{subscriptionId}")}, + // ImpactedTenants: []*string{ + // }, + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T21:05:00Z"); return t}()), + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // }}, + // ImpactedService: to.Ptr("Virtual Machines"), + // }}, + // ImpactMitigationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // ImpactStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), + // IsHIR: to.Ptr(false), + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // Level: to.Ptr(armresourcehealth.LevelValuesWarning), + // Links: []*armresourcehealth.Link{ + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesHyperlink), + // BladeName: to.Ptr("RequestRCABlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Request RCA"), + // Value: to.Ptr("Request RCA"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "rcaRequested": "False", + // "trackingId": "BC_1-FXZ", + // }, + // }, + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesButton), + // BladeName: to.Ptr("AzureHealthBrowseBlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Sign up for updates"), + // Value: to.Ptr("Sign up for updates"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "trackingId": "BC_1-FXZ", + // }, + // }}, + // Priority: to.Ptr[int32](2), + // RecommendedActions: &armresourcehealth.EventPropertiesRecommendedActions{ + // Actions: []*armresourcehealth.EventPropertiesRecommendedActionsItem{ + // { + // ActionText: to.Ptr("action 1"), + // GroupID: to.Ptr[int32](23243), + // }, + // { + // ActionText: to.Ptr("action 2"), + // GroupID: to.Ptr[int32](23432), + // }}, + // LocaleCode: to.Ptr("en"), + // Message: to.Ptr("Recommended actions title"), + // }, + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // Summary: to.Ptr("An outage alert is being investigated. More information will be provided as it is known."), + // Title: to.Ptr("ACTIVE: Virtual machines in West US"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json +func ExampleEventsClient_NewListByTenantIDPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEventsClient().NewListByTenantIDPager(&armresourcehealth.EventsClientListByTenantIDOptions{Filter: to.Ptr("service eq 'Virtual Machines' or region eq 'West US'"), + QueryStartTime: to.Ptr("7/24/2020"), + }) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.Events = armresourcehealth.Events{ + // Value: []*armresourcehealth.Event{ + // { + // Name: to.Ptr("BC_1-FXZ"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/events"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/BC_1-FXZ"), + // Properties: &armresourcehealth.EventProperties{ + // Article: &armresourcehealth.EventPropertiesArticle{ + // ArticleContent: to.Ptr("An outage alert is being investigated. More information will be provided as it is known"), + // }, + // EnableChatWithUs: to.Ptr(false), + // EnableMicrosoftSupport: to.Ptr(true), + // EventLevel: to.Ptr(armresourcehealth.EventLevelValuesInformational), + // EventSource: to.Ptr(armresourcehealth.EventSourceValuesServiceHealth), + // EventType: to.Ptr(armresourcehealth.EventTypeValuesServiceIssue), + // Faqs: []*armresourcehealth.Faq{ + // { + // Answer: to.Ptr("This is an answer"), + // LocaleCode: to.Ptr("en"), + // Question: to.Ptr("This is a question"), + // }}, + // Header: to.Ptr("Your service might have been impacted by an Azure service issue"), + // HirStage: to.Ptr("resolved"), + // Impact: []*armresourcehealth.Impact{ + // { + // ImpactedRegions: []*armresourcehealth.ImpactedServiceRegion{ + // { + // ImpactedRegion: to.Ptr("West US"), + // ImpactedSubscriptions: []*string{ + // }, + // ImpactedTenants: []*string{ + // to.Ptr("00000000-0000-0000-0000-000000000000")}, + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T21:05:00Z"); return t}()), + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // }}, + // ImpactedService: to.Ptr("Virtual Machines"), + // }}, + // ImpactMitigationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // ImpactStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), + // IsHIR: to.Ptr(false), + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // Level: to.Ptr(armresourcehealth.LevelValuesWarning), + // Links: []*armresourcehealth.Link{ + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesHyperlink), + // BladeName: to.Ptr("RequestRCABlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Request RCA"), + // Value: to.Ptr("Request RCA"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "rcaRequested": "False", + // "trackingId": "BC_1-FXZ", + // }, + // }, + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesButton), + // BladeName: to.Ptr("AzureHealthBrowseBlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Sign up for updates"), + // Value: to.Ptr("Sign up for updates"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "trackingId": "BC_1-FXZ", + // }, + // }}, + // Priority: to.Ptr[int32](2), + // RecommendedActions: &armresourcehealth.EventPropertiesRecommendedActions{ + // Actions: []*armresourcehealth.EventPropertiesRecommendedActionsItem{ + // { + // ActionText: to.Ptr("action 1"), + // GroupID: to.Ptr[int32](23243), + // }, + // { + // ActionText: to.Ptr("action 2"), + // GroupID: to.Ptr[int32](23432), + // }}, + // LocaleCode: to.Ptr("en"), + // Message: to.Ptr("Recommended actions title"), + // }, + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // Summary: to.Ptr("An outage alert is being investigated. More information will be provided as it is known."), + // Title: to.Ptr("ACTIVE: Virtual machines in West US"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json +func ExampleEventsClient_NewListBySingleResourcePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEventsClient().NewListBySingleResourcePager("subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI", &armresourcehealth.EventsClientListBySingleResourceOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.Events = armresourcehealth.Events{ + // Value: []*armresourcehealth.Event{ + // { + // Name: to.Ptr("BC_1-FXZ"), + // Type: to.Ptr("/providers/Microsoft.ResourceHealth/events"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/BC_1-FXZ"), + // Properties: &armresourcehealth.EventProperties{ + // Article: &armresourcehealth.EventPropertiesArticle{ + // ArticleContent: to.Ptr("An outage alert is being investigated. More information will be provided as it is known"), + // }, + // EnableChatWithUs: to.Ptr(false), + // EnableMicrosoftSupport: to.Ptr(true), + // EventLevel: to.Ptr(armresourcehealth.EventLevelValuesInformational), + // EventSource: to.Ptr(armresourcehealth.EventSourceValuesResourceHealth), + // EventType: to.Ptr(armresourcehealth.EventTypeValuesServiceIssue), + // Faqs: []*armresourcehealth.Faq{ + // { + // Answer: to.Ptr("This is an answer"), + // LocaleCode: to.Ptr("en"), + // Question: to.Ptr("This is a question"), + // }}, + // Header: to.Ptr("Your service might have been impacted by an Azure service issue"), + // HirStage: to.Ptr("active"), + // Impact: []*armresourcehealth.Impact{ + // { + // ImpactedRegions: []*armresourcehealth.ImpactedServiceRegion{ + // { + // ImpactedRegion: to.Ptr("West US"), + // ImpactedSubscriptions: []*string{ + // to.Ptr("{subscriptionId}")}, + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T21:05:00Z"); return t}()), + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // }}, + // ImpactedService: to.Ptr("Virtual Machines"), + // }}, + // ImpactMitigationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // ImpactStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), + // IsHIR: to.Ptr(false), + // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-08T00:00:00Z"); return t}()), + // Level: to.Ptr(armresourcehealth.LevelValuesWarning), + // Links: []*armresourcehealth.Link{ + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesHyperlink), + // BladeName: to.Ptr("RequestRCABlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Request RCA"), + // Value: to.Ptr("Request RCA"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "rcaRequested": "False", + // "trackingId": "BC_1-FXZ", + // }, + // }, + // { + // Type: to.Ptr(armresourcehealth.LinkTypeValuesButton), + // BladeName: to.Ptr("AzureHealthBrowseBlade"), + // DisplayText: &armresourcehealth.LinkDisplayText{ + // LocalizedValue: to.Ptr("Sign up for updates"), + // Value: to.Ptr("Sign up for updates"), + // }, + // ExtensionName: to.Ptr("Microsoft_Azure_Health"), + // Parameters: map[string]any{ + // "trackingId": "BC_1-FXZ", + // }, + // }}, + // Priority: to.Ptr[int32](2), + // RecommendedActions: &armresourcehealth.EventPropertiesRecommendedActions{ + // Actions: []*armresourcehealth.EventPropertiesRecommendedActionsItem{ + // { + // ActionText: to.Ptr("action 1"), + // GroupID: to.Ptr[int32](23243), + // }, + // { + // ActionText: to.Ptr("action 2"), + // GroupID: to.Ptr[int32](23432), + // }}, + // LocaleCode: to.Ptr("en"), + // Message: to.Ptr("Recommended actions title"), + // }, + // Status: to.Ptr(armresourcehealth.EventStatusValuesActive), + // Summary: to.Ptr("An outage alert is being investigated. More information will be provided as it is known."), + // Title: to.Ptr("ACTIVE: Virtual machines in West US"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod index d065131e0cf9..138f609e7a88 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armr go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect ) diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum index 8ba445a8c4da..21718b486698 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum @@ -1,13 +1,13 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= +github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -18,14 +18,14 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/impactedresources_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/impactedresources_client.go new file mode 100644 index 000000000000..f5ffd2bd1acc --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/impactedresources_client.go @@ -0,0 +1,288 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ImpactedResourcesClient contains the methods for the ImpactedResources group. +// Don't use this type directly, use NewImpactedResourcesClient() instead. +type ImpactedResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewImpactedResourcesClient creates a new instance of ImpactedResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewImpactedResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImpactedResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".ImpactedResourcesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ImpactedResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the specific impacted resource in the subscription by an event. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - impactedResourceName - Name of the Impacted Resource. +// - options - ImpactedResourcesClientGetOptions contains the optional parameters for the ImpactedResourcesClient.Get method. +func (client *ImpactedResourcesClient) Get(ctx context.Context, eventTrackingID string, impactedResourceName string, options *ImpactedResourcesClientGetOptions) (ImpactedResourcesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, eventTrackingID, impactedResourceName, options) + if err != nil { + return ImpactedResourcesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImpactedResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImpactedResourcesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ImpactedResourcesClient) getCreateRequest(ctx context.Context, eventTrackingID string, impactedResourceName string, options *ImpactedResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + if impactedResourceName == "" { + return nil, errors.New("parameter impactedResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{impactedResourceName}", url.PathEscape(impactedResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ImpactedResourcesClient) getHandleResponse(resp *http.Response) (ImpactedResourcesClientGetResponse, error) { + result := ImpactedResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventImpactedResource); err != nil { + return ImpactedResourcesClientGetResponse{}, err + } + return result, nil +} + +// GetByTenantID - Gets the specific impacted resource in the tenant by an event. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - impactedResourceName - Name of the Impacted Resource. +// - options - ImpactedResourcesClientGetByTenantIDOptions contains the optional parameters for the ImpactedResourcesClient.GetByTenantID +// method. +func (client *ImpactedResourcesClient) GetByTenantID(ctx context.Context, eventTrackingID string, impactedResourceName string, options *ImpactedResourcesClientGetByTenantIDOptions) (ImpactedResourcesClientGetByTenantIDResponse, error) { + req, err := client.getByTenantIDCreateRequest(ctx, eventTrackingID, impactedResourceName, options) + if err != nil { + return ImpactedResourcesClientGetByTenantIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImpactedResourcesClientGetByTenantIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImpactedResourcesClientGetByTenantIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByTenantIDHandleResponse(resp) +} + +// getByTenantIDCreateRequest creates the GetByTenantID request. +func (client *ImpactedResourcesClient) getByTenantIDCreateRequest(ctx context.Context, eventTrackingID string, impactedResourceName string, options *ImpactedResourcesClientGetByTenantIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + if impactedResourceName == "" { + return nil, errors.New("parameter impactedResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{impactedResourceName}", url.PathEscape(impactedResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByTenantIDHandleResponse handles the GetByTenantID response. +func (client *ImpactedResourcesClient) getByTenantIDHandleResponse(resp *http.Response) (ImpactedResourcesClientGetByTenantIDResponse, error) { + result := ImpactedResourcesClientGetByTenantIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventImpactedResource); err != nil { + return ImpactedResourcesClientGetByTenantIDResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionIDAndEventIDPager - Lists impacted resources in the subscription by an event. +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - options - ImpactedResourcesClientListBySubscriptionIDAndEventIDOptions contains the optional parameters for the ImpactedResourcesClient.NewListBySubscriptionIDAndEventIDPager +// method. +func (client *ImpactedResourcesClient) NewListBySubscriptionIDAndEventIDPager(eventTrackingID string, options *ImpactedResourcesClientListBySubscriptionIDAndEventIDOptions) *runtime.Pager[ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse] { + return runtime.NewPager(runtime.PagingHandler[ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse]{ + More: func(page ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse) (ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionIDAndEventIDCreateRequest(ctx, eventTrackingID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionIDAndEventIDHandleResponse(resp) + }, + }) +} + +// listBySubscriptionIDAndEventIDCreateRequest creates the ListBySubscriptionIDAndEventID request. +func (client *ImpactedResourcesClient) listBySubscriptionIDAndEventIDCreateRequest(ctx context.Context, eventTrackingID string, options *ImpactedResourcesClientListBySubscriptionIDAndEventIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionIDAndEventIDHandleResponse handles the ListBySubscriptionIDAndEventID response. +func (client *ImpactedResourcesClient) listBySubscriptionIDAndEventIDHandleResponse(resp *http.Response) (ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse, error) { + result := ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventImpactedResourceListResult); err != nil { + return ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{}, err + } + return result, nil +} + +// NewListByTenantIDAndEventIDPager - Lists impacted resources in the tenant by an event. +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - options - ImpactedResourcesClientListByTenantIDAndEventIDOptions contains the optional parameters for the ImpactedResourcesClient.NewListByTenantIDAndEventIDPager +// method. +func (client *ImpactedResourcesClient) NewListByTenantIDAndEventIDPager(eventTrackingID string, options *ImpactedResourcesClientListByTenantIDAndEventIDOptions) *runtime.Pager[ImpactedResourcesClientListByTenantIDAndEventIDResponse] { + return runtime.NewPager(runtime.PagingHandler[ImpactedResourcesClientListByTenantIDAndEventIDResponse]{ + More: func(page ImpactedResourcesClientListByTenantIDAndEventIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImpactedResourcesClientListByTenantIDAndEventIDResponse) (ImpactedResourcesClientListByTenantIDAndEventIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByTenantIDAndEventIDCreateRequest(ctx, eventTrackingID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ImpactedResourcesClientListByTenantIDAndEventIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImpactedResourcesClientListByTenantIDAndEventIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImpactedResourcesClientListByTenantIDAndEventIDResponse{}, runtime.NewResponseError(resp) + } + return client.listByTenantIDAndEventIDHandleResponse(resp) + }, + }) +} + +// listByTenantIDAndEventIDCreateRequest creates the ListByTenantIDAndEventID request. +func (client *ImpactedResourcesClient) listByTenantIDAndEventIDCreateRequest(ctx context.Context, eventTrackingID string, options *ImpactedResourcesClientListByTenantIDAndEventIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTenantIDAndEventIDHandleResponse handles the ListByTenantIDAndEventID response. +func (client *ImpactedResourcesClient) listByTenantIDAndEventIDHandleResponse(resp *http.Response) (ImpactedResourcesClientListByTenantIDAndEventIDResponse, error) { + result := ImpactedResourcesClientListByTenantIDAndEventIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventImpactedResourceListResult); err != nil { + return ImpactedResourcesClientListByTenantIDAndEventIDResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/impactedresources_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/impactedresources_client_example_test.go new file mode 100644 index 000000000000..32ea924fd3a1 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/impactedresources_client_example_test.go @@ -0,0 +1,199 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json +func ExampleImpactedResourcesClient_NewListBySubscriptionIDAndEventIDPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewImpactedResourcesClient().NewListBySubscriptionIDAndEventIDPager("BC_1-FXZ", &armresourcehealth.ImpactedResourcesClientListBySubscriptionIDAndEventIDOptions{Filter: to.Ptr("targetRegion eq 'westus'")}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.EventImpactedResourceListResult = armresourcehealth.EventImpactedResourceListResult{ + // Value: []*armresourcehealth.EventImpactedResource{ + // { + // Name: to.Ptr("abc-123-ghj-456"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/subscriptions/{subscripitionId}/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/abc-123-ghj-456"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // TargetRegion: to.Ptr("westus"), + // TargetResourceID: to.Ptr("/subscriptions/4970d23e-ed41-4670-9c19-02a1d2808dd9/resourceGroups/TEST/providers/Microsoft.Compute/virtualMachines/testvm"), + // TargetResourceType: to.Ptr("Microsoft.Compute/VirtualMachines"), + // }, + // }, + // { + // Name: to.Ptr("jkl-901-hgy-445"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/subscriptions/{subscripitionId}/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/jkl-901-hgy-445"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // Info: []*armresourcehealth.KeyValueItem{ + // { + // Key: to.Ptr("ContainerGrp"), + // Value: to.Ptr("xyz"), + // }, + // { + // Key: to.Ptr("UserGuid"), + // Value: to.Ptr("guid"), + // }, + // { + // Key: to.Ptr("AplicationID"), + // Value: to.Ptr("Abc"), + // }, + // { + // Key: to.Ptr("UserPrincipalObjectId"), + // Value: to.Ptr("def"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("wer-345-tyu-789"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/subscriptions/{subscripitionId}/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/wer-345-tyu-789"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // TargetRegion: to.Ptr("westus"), + // TargetResourceID: to.Ptr("/subscriptions/4970d23e-ed41-4670-9c19-02a1d2808dd9/resourceGroups/Dev2/providers/Microsoft.Compute/virtualMachines/testvm2"), + // TargetResourceType: to.Ptr("Microsoft.Compute/VirtualMachines"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json +func ExampleImpactedResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewImpactedResourcesClient().Get(ctx, "BC_1-FXZ", "abc-123-ghj-456", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.EventImpactedResource = armresourcehealth.EventImpactedResource{ + // Name: to.Ptr("abc-123-ghj-456"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/subscriptions/{subscripitionId}/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/abc-123-ghj-456"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // TargetRegion: to.Ptr("westus"), + // TargetResourceID: to.Ptr("/subscriptions/4970d23e-ed41-4670-9c19-02a1d2808dd9/resourceGroups/TEST/providers/Microsoft.Compute/virtualMachines/testvm"), + // TargetResourceType: to.Ptr("Microsoft.Compute/VirtualMachines"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json +func ExampleImpactedResourcesClient_NewListByTenantIDAndEventIDPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewImpactedResourcesClient().NewListByTenantIDAndEventIDPager("BC_1-FXZ", &armresourcehealth.ImpactedResourcesClientListByTenantIDAndEventIDOptions{Filter: to.Ptr("targetRegion eq 'westus'")}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.EventImpactedResourceListResult = armresourcehealth.EventImpactedResourceListResult{ + // Value: []*armresourcehealth.EventImpactedResource{ + // { + // Name: to.Ptr("abc-123-ghj-456"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/abc-123-ghj-456"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // TargetRegion: to.Ptr("westus"), + // TargetResourceID: to.Ptr("{resourceId-1}"), + // TargetResourceType: to.Ptr("Microsoft.Compute/VirtualMachines"), + // }, + // }, + // { + // Name: to.Ptr("wer-345-tyu-789"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/wer-345-tyu-789"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // TargetRegion: to.Ptr("westus"), + // TargetResourceID: to.Ptr("{resourceId-2}"), + // TargetResourceType: to.Ptr("Microsoft.Compute/VirtualMachines"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json +func ExampleImpactedResourcesClient_GetByTenantID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewImpactedResourcesClient().GetByTenantID(ctx, "BC_1-FXZ", "abc-123-ghj-456", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.EventImpactedResource = armresourcehealth.EventImpactedResource{ + // Name: to.Ptr("abc-123-ghj-456"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/abc-123-ghj-456"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // TargetRegion: to.Ptr("westus"), + // TargetResourceID: to.Ptr("{resourceId}"), + // TargetResourceType: to.Ptr("Microsoft.Compute/VirtualMachines"), + // }, + // } +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/metadata_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/metadata_client.go new file mode 100644 index 000000000000..4cf5111cc63a --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/metadata_client.go @@ -0,0 +1,145 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MetadataClient contains the methods for the Metadata group. +// Don't use this type directly, use NewMetadataClient() instead. +type MetadataClient struct { + internal *arm.Client +} + +// NewMetadataClient creates a new instance of MetadataClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MetadataClient, error) { + cl, err := arm.NewClient(moduleName+".MetadataClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MetadataClient{ + internal: cl, + } + return client, nil +} + +// GetEntity - Gets the list of metadata entities. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-01 +// - name - Name of metadata entity. +// - options - MetadataClientGetEntityOptions contains the optional parameters for the MetadataClient.GetEntity method. +func (client *MetadataClient) GetEntity(ctx context.Context, name string, options *MetadataClientGetEntityOptions) (MetadataClientGetEntityResponse, error) { + req, err := client.getEntityCreateRequest(ctx, name, options) + if err != nil { + return MetadataClientGetEntityResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MetadataClientGetEntityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MetadataClientGetEntityResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityHandleResponse(resp) +} + +// getEntityCreateRequest creates the GetEntity request. +func (client *MetadataClient) getEntityCreateRequest(ctx context.Context, name string, options *MetadataClientGetEntityOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/metadata/{name}" + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityHandleResponse handles the GetEntity response. +func (client *MetadataClient) getEntityHandleResponse(resp *http.Response) (MetadataClientGetEntityResponse, error) { + result := MetadataClientGetEntityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetadataEntity); err != nil { + return MetadataClientGetEntityResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the list of metadata entities. +// +// Generated from API version 2022-10-01 +// - options - MetadataClientListOptions contains the optional parameters for the MetadataClient.NewListPager method. +func (client *MetadataClient) NewListPager(options *MetadataClientListOptions) *runtime.Pager[MetadataClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[MetadataClientListResponse]{ + More: func(page MetadataClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MetadataClientListResponse) (MetadataClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MetadataClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MetadataClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MetadataClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *MetadataClient) listCreateRequest(ctx context.Context, options *MetadataClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/metadata" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MetadataClient) listHandleResponse(resp *http.Response) (MetadataClientListResponse, error) { + result := MetadataClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetadataEntityListResult); err != nil { + return MetadataClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/metadata_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/metadata_client_example_test.go new file mode 100644 index 000000000000..abbb8eecbfa1 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/metadata_client_example_test.go @@ -0,0 +1,1987 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json +func ExampleMetadataClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMetadataClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.MetadataEntityListResult = armresourcehealth.MetadataEntityListResult{ + // Value: []*armresourcehealth.MetadataEntity{ + // { + // Name: to.Ptr("status"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/status"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // ApplicableScenarios: []*armresourcehealth.Scenario{ + // to.Ptr(armresourcehealth.ScenarioAlerts)}, + // DisplayName: to.Ptr("Status"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("Active"), + // ID: to.Ptr("Active"), + // }, + // { + // DisplayName: to.Ptr("Resolved"), + // ID: to.Ptr("Resolved"), + // }, + // { + // DisplayName: to.Ptr("In Progress"), + // ID: to.Ptr("In Progress"), + // }, + // { + // DisplayName: to.Ptr("Updated"), + // ID: to.Ptr("Updated"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("level"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/level"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // ApplicableScenarios: []*armresourcehealth.Scenario{ + // to.Ptr(armresourcehealth.ScenarioAlerts)}, + // DisplayName: to.Ptr("Level"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("Informational"), + // ID: to.Ptr("Informational"), + // }, + // { + // DisplayName: to.Ptr("Critical"), + // ID: to.Ptr("Critical"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("cause"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/cause"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // ApplicableScenarios: []*armresourcehealth.Scenario{ + // to.Ptr(armresourcehealth.ScenarioAlerts)}, + // DisplayName: to.Ptr("Cause"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("Platform Initiated"), + // ID: to.Ptr("PlatformInitiated"), + // }, + // { + // DisplayName: to.Ptr("User Initiated"), + // ID: to.Ptr("UserInitiated"), + // }, + // { + // DisplayName: to.Ptr("Unknown"), + // ID: to.Ptr("Unknown"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("previousHealthStatus"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/previousHealthStatus"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // ApplicableScenarios: []*armresourcehealth.Scenario{ + // to.Ptr(armresourcehealth.ScenarioAlerts)}, + // DisplayName: to.Ptr("Previous Health Status"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("Available"), + // ID: to.Ptr("Available"), + // }, + // { + // DisplayName: to.Ptr("Unavailable"), + // ID: to.Ptr("Unavailable"), + // }, + // { + // DisplayName: to.Ptr("Degraded"), + // ID: to.Ptr("Degraded"), + // }, + // { + // DisplayName: to.Ptr("Unknown"), + // ID: to.Ptr("Unknown"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("currentHealthStatus"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/currentHealthStatus"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // ApplicableScenarios: []*armresourcehealth.Scenario{ + // to.Ptr(armresourcehealth.ScenarioAlerts)}, + // DisplayName: to.Ptr("Current Health Status"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("Available"), + // ID: to.Ptr("Available"), + // }, + // { + // DisplayName: to.Ptr("Unavailable"), + // ID: to.Ptr("Unavailable"), + // }, + // { + // DisplayName: to.Ptr("Degraded"), + // ID: to.Ptr("Degraded"), + // }, + // { + // DisplayName: to.Ptr("Unknown"), + // ID: to.Ptr("Unknown"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("supportedResourceType"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/supportedResourceType"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // DisplayName: to.Ptr("Supported Resource Type"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("Analysis Services"), + // ID: to.Ptr("Microsoft.AnalysisServices/servers"), + // }, + // { + // DisplayName: to.Ptr("API Management service"), + // ID: to.Ptr("Microsoft.ApiManagement/service"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.AppPlatform/Spring"), + // ID: to.Ptr("Microsoft.AppPlatform/Spring"), + // }, + // { + // DisplayName: to.Ptr("Azure Data Explorer Cluster"), + // ID: to.Ptr("Microsoft.Kusto/Clusters"), + // }, + // { + // DisplayName: to.Ptr("Azure Data Explorer Data Connection"), + // ID: to.Ptr("Microsoft.Kusto/clusters/databases/dataconnections"), + // }, + // { + // DisplayName: to.Ptr("microsoft.fluidrelay/fluidrelayservers"), + // ID: to.Ptr("microsoft.fluidrelay/fluidrelayservers"), + // }, + // { + // DisplayName: to.Ptr("AKS cluster"), + // ID: to.Ptr("microsoft.ContainerService/managedClusters"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.Dashboard/grafana"), + // ID: to.Ptr("Microsoft.Dashboard/grafana"), + // }, + // { + // DisplayName: to.Ptr("Azure Purview"), + // ID: to.Ptr("Microsoft.Purview/accounts"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.SignalRService/SignalR"), + // ID: to.Ptr("Microsoft.SignalRService/SignalR"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // }, + // { + // DisplayName: to.Ptr("Batch account"), + // ID: to.Ptr("Microsoft.Batch/batchAccounts"), + // }, + // { + // DisplayName: to.Ptr("Redis cache"), + // ID: to.Ptr("Microsoft.Cache/Redis"), + // }, + // { + // DisplayName: to.Ptr("Cdn profile"), + // ID: to.Ptr("Microsoft.Cdn/profiles"), + // }, + // { + // DisplayName: to.Ptr("Cloud services (classic)"), + // ID: to.Ptr("Microsoft.ClassicCompute/DomainNames"), + // }, + // { + // DisplayName: to.Ptr("Virtual machine (classic)"), + // ID: to.Ptr("Microsoft.ClassicCompute/virtualMachines"), + // }, + // { + // DisplayName: to.Ptr("Cognitive Services account"), + // ID: to.Ptr("Microsoft.CognitiveServices/accounts"), + // }, + // { + // DisplayName: to.Ptr("Azure Dedicated Host"), + // ID: to.Ptr("Microsoft.Compute/hostGroups/hosts"), + // }, + // { + // DisplayName: to.Ptr("Virtual machine"), + // ID: to.Ptr("Microsoft.Compute/virtualMachines"), + // }, + // { + // DisplayName: to.Ptr("Virtual machine scale sets"), + // ID: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), + // }, + // { + // DisplayName: to.Ptr("microsoft.connectedvmwarevsphere/vcenters"), + // ID: to.Ptr("microsoft.connectedvmwarevsphere/vcenters"), + // }, + // { + // DisplayName: to.Ptr("Data factory"), + // ID: to.Ptr("Microsoft.DataFactory/factories"), + // }, + // { + // DisplayName: to.Ptr("Data Lake Analytics account"), + // ID: to.Ptr("Microsoft.DataLakeAnalytics/accounts"), + // }, + // { + // DisplayName: to.Ptr("Data Lake Store account"), + // ID: to.Ptr("Microsoft.DataLakeStore/accounts"), + // }, + // { + // DisplayName: to.Ptr("Azure Database Migration Service"), + // ID: to.Ptr("Microsoft.DataMigration/services"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.DataProtection/BackupVaults"), + // ID: to.Ptr("Microsoft.DataProtection/BackupVaults"), + // }, + // { + // DisplayName: to.Ptr("Azure Data Share account"), + // ID: to.Ptr("Microsoft.DataShare/accounts"), + // }, + // { + // DisplayName: to.Ptr("Azure Database for MariaDB servers"), + // ID: to.Ptr("Microsoft.DBforMariaDB/servers"), + // }, + // { + // DisplayName: to.Ptr("Azure Database for MySQL flexible servers"), + // ID: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), + // }, + // { + // DisplayName: to.Ptr("Azure Database for MySQL servers"), + // ID: to.Ptr("Microsoft.DBforMySQL/servers"), + // }, + // { + // DisplayName: to.Ptr("Azure Database for PostgreSQL Flexible Server"), + // ID: to.Ptr("Microsoft.DBforPostgreSQL/flexibleservers"), + // }, + // { + // DisplayName: to.Ptr("Azure Database for PostgreSQL servers"), + // ID: to.Ptr("Microsoft.DBforPostgreSQL/servers"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.DBforPostgreSQL/serverGroupsv2"), + // ID: to.Ptr("Microsoft.DBforPostgreSQL/serverGroupsv2"), + // }, + // { + // DisplayName: to.Ptr("IoT Hub"), + // ID: to.Ptr("Microsoft.Devices/IotHubs"), + // }, + // { + // DisplayName: to.Ptr("Azure Digital Twins"), + // ID: to.Ptr("Microsoft.DigitalTwins/DigitalTwinsInstances"), + // }, + // { + // DisplayName: to.Ptr("Cosmos DB"), + // ID: to.Ptr("Microsoft.Documentdb/databaseaccounts"), + // }, + // { + // DisplayName: to.Ptr("Event Hub"), + // ID: to.Ptr("Microsoft.EventHub/namespaces"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.ExtendedLocation/customLocations"), + // ID: to.Ptr("Microsoft.ExtendedLocation/customLocations"), + // }, + // { + // DisplayName: to.Ptr("HDInsight clusters"), + // ID: to.Ptr("Microsoft.HdInsight/clusters"), + // }, + // { + // DisplayName: to.Ptr("Azure Arc enabled servers"), + // ID: to.Ptr("Microsoft.HybridCompute/machines"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.HybridNetwork/devices"), + // ID: to.Ptr("Microsoft.HybridNetwork/devices"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.HybridNetwork/networkFunctions"), + // ID: to.Ptr("Microsoft.HybridNetwork/networkFunctions"), + // }, + // { + // DisplayName: to.Ptr("IoT Central Application"), + // ID: to.Ptr("Microsoft.IoTCentral/IoTApps"), + // }, + // { + // DisplayName: to.Ptr("Key vault"), + // ID: to.Ptr("Microsoft.KeyVault/vaults"), + // }, + // { + // DisplayName: to.Ptr("Azure Arc enabled Kubernetes"), + // ID: to.Ptr("Microsoft.Kubernetes/connectedClusters"), + // }, + // { + // DisplayName: to.Ptr("Machine Learning Studio web services"), + // ID: to.Ptr("Microsoft.MachineLearning/webServices"), + // }, + // { + // DisplayName: to.Ptr("Media service"), + // ID: to.Ptr("Microsoft.media/mediaservices"), + // }, + // { + // DisplayName: to.Ptr("Application Gateway"), + // ID: to.Ptr("Microsoft.Network/applicationGateways"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.Network/bastionHosts"), + // ID: to.Ptr("Microsoft.Network/bastionHosts"), + // }, + // { + // DisplayName: to.Ptr("VPN Connection"), + // ID: to.Ptr("Microsoft.Network/Connections"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.Network/dnsResolvers/inboundEndpoints"), + // ID: to.Ptr("Microsoft.Network/dnsResolvers/inboundEndpoints"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.Network/dnsResolvers"), + // ID: to.Ptr("Microsoft.Network/dnsResolvers"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.Network/dnsResolvers/outboundEndpoints"), + // ID: to.Ptr("Microsoft.Network/dnsResolvers/outboundEndpoints"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.Network/dnszones"), + // ID: to.Ptr("Microsoft.Network/dnszones"), + // }, + // { + // DisplayName: to.Ptr("ExpressRoute circuit"), + // ID: to.Ptr("Microsoft.Network/expressRouteCircuits"), + // }, + // { + // DisplayName: to.Ptr("Express RouteGateways"), + // ID: to.Ptr("Microsoft.Network/ExpressRouteGateways"), + // }, + // { + // DisplayName: to.Ptr("Front Door"), + // ID: to.Ptr("Microsoft.Network/frontdoors"), + // }, + // { + // DisplayName: to.Ptr("Load balancer"), + // ID: to.Ptr("Microsoft.Network/LoadBalancers"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.Network/NATGateways"), + // ID: to.Ptr("Microsoft.Network/NATGateways"), + // }, + // { + // DisplayName: to.Ptr("Traffic Manager profile"), + // ID: to.Ptr("Microsoft.Network/trafficmanagerprofiles"), + // }, + // { + // DisplayName: to.Ptr("VPN Gateway"), + // ID: to.Ptr("Microsoft.Network/virtualNetworkGateways"), + // }, + // { + // DisplayName: to.Ptr("Notification Hub namespace"), + // ID: to.Ptr("Microsoft.NotificationHubs/Namespaces"), + // }, + // { + // DisplayName: to.Ptr("Log Analytics workspace"), + // ID: to.Ptr("Microsoft.OperationalInsights/workspaces"), + // }, + // { + // DisplayName: to.Ptr("Power BI Embedded"), + // ID: to.Ptr("Microsoft.PowerBIDedicated/capacities"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.RecoveryServices/vaults"), + // ID: to.Ptr("Microsoft.RecoveryServices/vaults"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.ResourceConnector/appliances"), + // ID: to.Ptr("Microsoft.ResourceConnector/appliances"), + // }, + // { + // DisplayName: to.Ptr("Search service"), + // ID: to.Ptr("Microsoft.Search/searchServices"), + // }, + // { + // DisplayName: to.Ptr("Service Bus"), + // ID: to.Ptr("Microsoft.ServiceBus/namespaces"), + // }, + // { + // DisplayName: to.Ptr("Service Fabric cluster"), + // ID: to.Ptr("Microsoft.ServiceFabric/clusters"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.ServiceFabric/managedClusters"), + // ID: to.Ptr("Microsoft.ServiceFabric/managedClusters"), + // }, + // { + // DisplayName: to.Ptr("Managed database"), + // ID: to.Ptr("Microsoft.Sql/managedInstances/databases"), + // }, + // { + // DisplayName: to.Ptr("Managed instance"), + // ID: to.Ptr("Microsoft.Sql/managedInstances"), + // }, + // { + // DisplayName: to.Ptr("SQL database"), + // ID: to.Ptr("Microsoft.Sql/servers/databases"), + // }, + // { + // DisplayName: to.Ptr("Storage account"), + // ID: to.Ptr("Microsoft.Storage/storageAccounts"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.StorageCache/caches"), + // ID: to.Ptr("Microsoft.StorageCache/caches"), + // }, + // { + // DisplayName: to.Ptr("Stream Analytics job"), + // ID: to.Ptr("Microsoft.StreamAnalytics/streamingjobs"), + // }, + // { + // DisplayName: to.Ptr("Microsoft.Synapse/workspaces"), + // ID: to.Ptr("Microsoft.Synapse/workspaces"), + // }, + // { + // DisplayName: to.Ptr("App Service plan"), + // ID: to.Ptr("Microsoft.Web/serverFarms"), + // }, + // { + // DisplayName: to.Ptr("Website"), + // ID: to.Ptr("Microsoft.Web/sites"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("supportedEventTypes"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/supportedEventTypes"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // DisplayName: to.Ptr("Supported Service Health Event Types"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("Planned Maintenance"), + // ID: to.Ptr("Maintenance"), + // }, + // { + // DisplayName: to.Ptr("Health Advisories"), + // ID: to.Ptr("Informational"), + // }, + // { + // DisplayName: to.Ptr("Security Advisories"), + // ID: to.Ptr("Security"), + // }, + // { + // DisplayName: to.Ptr("Health Advisories"), + // ID: to.Ptr("ActionRequired"), + // }, + // { + // DisplayName: to.Ptr("Service Issue"), + // ID: to.Ptr("Incident"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("supportedServices"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/supportedServices"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // DisplayName: to.Ptr("Supported Service Health Services"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("API Management"), + // ID: to.Ptr("API Management"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.apimanagement/service")}, + // }, + // { + // DisplayName: to.Ptr("Action Groups"), + // ID: to.Ptr("Action Groups"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.insights/actiongroups"), + // to.Ptr("microsoft.alertsmanagement/alerts")}, + // }, + // { + // DisplayName: to.Ptr("Activity Logs & Alerts"), + // ID: to.Ptr("Activity Logs & Alerts"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.insights/alertrules"), + // to.Ptr("microsoft.insights/activitylogalerts"), + // to.Ptr("microsoft.alertsmanagement/alerts")}, + // }, + // { + // DisplayName: to.Ptr("Advisor"), + // ID: to.Ptr("Advisor"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Alerts"), + // ID: to.Ptr("Alerts"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.insights/alertrules"), + // to.Ptr("microsoft.insights/activitylogalerts"), + // to.Ptr("microsoft.insights/metricalerts"), + // to.Ptr("microsoft.insights/scheduledqueryrules"), + // to.Ptr("microsoft.insights/actiongroups"), + // to.Ptr("microsoft.alertsmanagement/alerts"), + // to.Ptr("microsoft.alertsmanagement/actionrules"), + // to.Ptr("microsoft.alertsmanagement/smartdetectoralertrules")}, + // }, + // { + // DisplayName: to.Ptr("Alerts & Metrics"), + // ID: to.Ptr("Alerts & Metrics"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.insights/alertrules"), + // to.Ptr("microsoft.insights/metricalerts"), + // to.Ptr("microsoft.alertsmanagement/alerts")}, + // }, + // { + // DisplayName: to.Ptr("App Service"), + // ID: to.Ptr("App Service"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.web/sites")}, + // }, + // { + // DisplayName: to.Ptr("App Service (Linux)"), + // ID: to.Ptr("App Service (Linux)"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.web/sites")}, + // }, + // { + // DisplayName: to.Ptr("App Service (Linux) \\ Web App for Containers"), + // ID: to.Ptr("App Service (Linux) \\ Web App for Containers"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.web/sites")}, + // }, + // { + // DisplayName: to.Ptr("App Service (Linux) \\ Web Apps"), + // ID: to.Ptr("App Service (Linux) \\ Web Apps"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.web/sites")}, + // }, + // { + // DisplayName: to.Ptr("App Service \\ Web Apps"), + // ID: to.Ptr("App Service \\ Web Apps"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.web/sites")}, + // }, + // { + // DisplayName: to.Ptr("Application Gateway"), + // ID: to.Ptr("Application Gateway"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/applicationgateways")}, + // }, + // { + // DisplayName: to.Ptr("Application Insights"), + // ID: to.Ptr("Application Insights"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.insights/components")}, + // }, + // { + // DisplayName: to.Ptr("AutoScale"), + // ID: to.Ptr("AutoScale"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.insights/autoscalesettings")}, + // }, + // { + // DisplayName: to.Ptr("Automation"), + // ID: to.Ptr("Automation"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.automation/automationaccounts"), + // to.Ptr("microsoft.automation/automationaccounts/runbooks"), + // to.Ptr("microsoft.automation/automationaccounts/jobs")}, + // }, + // { + // DisplayName: to.Ptr("Azure Active Directory"), + // ID: to.Ptr("Azure Active Directory"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Active Directory B2C"), + // ID: to.Ptr("Azure Active Directory B2C"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Active Directory Domain Services"), + // ID: to.Ptr("Azure Active Directory Domain Services"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.aad/domainservices")}, + // }, + // { + // DisplayName: to.Ptr("Azure Active Directory \\ Enterprise State Roaming"), + // ID: to.Ptr("Azure Active Directory \\ Enterprise State Roaming"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Analysis Services"), + // ID: to.Ptr("Azure Analysis Services"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.analysisservices/servers")}, + // }, + // { + // DisplayName: to.Ptr("Azure API for FHIR"), + // ID: to.Ptr("Azure API for FHIR"), + // ResourceTypes: []*string{ + // to.Ptr("Microsoft.HealthcareApis/services")}, + // }, + // { + // DisplayName: to.Ptr("Azure App Configuration"), + // ID: to.Ptr("Azure App Configuration"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Applied AI Services"), + // ID: to.Ptr("Azure Applied AI Services"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Arc enabled Kubernetes"), + // ID: to.Ptr("Azure Arc enabled Kubernetes"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.kubernetes/connectedclusters")}, + // }, + // { + // DisplayName: to.Ptr("Azure Arc enabled data services"), + // ID: to.Ptr("Azure Arc enabled data services"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Arc enabled servers"), + // ID: to.Ptr("Azure Arc enabled servers"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.hybridcompute/machines")}, + // }, + // { + // DisplayName: to.Ptr("Azure Bastion"), + // ID: to.Ptr("Azure Bastion"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/bastionhosts")}, + // }, + // { + // DisplayName: to.Ptr("Azure Blueprints"), + // ID: to.Ptr("Azure Blueprints"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Bot Service"), + // ID: to.Ptr("Azure Bot Service"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.botservice/botservices")}, + // }, + // { + // DisplayName: to.Ptr("Azure Chaos Studio"), + // ID: to.Ptr("Azure Chaos Studio"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Communication Services"), + // ID: to.Ptr("Azure Communication Services"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.communication/communicationservices")}, + // }, + // { + // DisplayName: to.Ptr("Azure Container Apps"), + // ID: to.Ptr("Azure Container Apps"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Container Registry"), + // ID: to.Ptr("Azure Container Registry"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.containerregistry/registries")}, + // }, + // { + // DisplayName: to.Ptr("Azure Container Service"), + // ID: to.Ptr("Azure Container Service"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.containerservice/managedclusters")}, + // }, + // { + // DisplayName: to.Ptr("Azure Cosmos DB"), + // ID: to.Ptr("Azure Cosmos DB"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.documentdb/databaseaccounts")}, + // }, + // { + // DisplayName: to.Ptr("Azure Cosmos DB for PostgreSQL"), + // ID: to.Ptr("Azure Cosmos DB for PostgreSQL"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.dbforpostgresql/servergroupsv2")}, + // }, + // { + // DisplayName: to.Ptr("Azure DDoS Protection"), + // ID: to.Ptr("Azure DDoS Protection"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure DNS"), + // ID: to.Ptr("Azure DNS"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/dnszones")}, + // }, + // { + // DisplayName: to.Ptr("Azure Data Explorer"), + // ID: to.Ptr("Azure Data Explorer"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.kusto/clusters"), + // to.Ptr("microsoft.kusto/clusters/databases/dataconnections")}, + // }, + // { + // DisplayName: to.Ptr("Azure Data Lake Storage Gen1"), + // ID: to.Ptr("Azure Data Lake Storage Gen1"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datalakestore/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Azure Data Lake Storage Gen2"), + // ID: to.Ptr("Azure Data Lake Storage Gen2"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datalakestore/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Azure Data Share"), + // ID: to.Ptr("Azure Data Share"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datashare/accounts"), + // to.Ptr("microsoft.datashare/shares"), + // to.Ptr("microsoft.datashare/sharesubscriptions"), + // to.Ptr("microsoft.datashare/datasets"), + // to.Ptr("microsoft.datashare/datasetmappings"), + // to.Ptr("microsoft.datashare/invitations")}, + // }, + // { + // DisplayName: to.Ptr("Azure Database for MySQL"), + // ID: to.Ptr("Azure Database for MySQL"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.dbformysql/servers")}, + // }, + // { + // DisplayName: to.Ptr("Azure Database for MySQL flexible servers"), + // ID: to.Ptr("Azure Database for MySQL flexible servers"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.dbformysql/flexibleservers")}, + // }, + // { + // DisplayName: to.Ptr("Azure Database for PostgreSQL"), + // ID: to.Ptr("Azure Database for PostgreSQL"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.dbforpostgresql/servers")}, + // }, + // { + // DisplayName: to.Ptr("Azure Database for PostgreSQL flexible servers"), + // ID: to.Ptr("Azure Database for PostgreSQL flexible servers"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.dbforpostgresql/flexibleservers")}, + // }, + // { + // DisplayName: to.Ptr("Azure Database Migration Service"), + // ID: to.Ptr("Azure Database Migration Service"), + // ResourceTypes: []*string{ + // to.Ptr("Microsoft.DataMigration/services")}, + // }, + // { + // DisplayName: to.Ptr("Azure Databricks"), + // ID: to.Ptr("Azure Databricks"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.databricks/workspaces")}, + // }, + // { + // DisplayName: to.Ptr("Azure Dedicated Host"), + // ID: to.Ptr("Azure Dedicated Host"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.compute/hostgroups/hosts")}, + // }, + // { + // DisplayName: to.Ptr("Azure DevOps"), + // ID: to.Ptr("Azure DevOps"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure DevOps \\ Artifacts"), + // ID: to.Ptr("Azure DevOps \\ Artifacts"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure DevOps \\ Boards"), + // ID: to.Ptr("Azure DevOps \\ Boards"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure DevOps \\ Pipelines"), + // ID: to.Ptr("Azure DevOps \\ Pipelines"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure DevOps \\ Repos"), + // ID: to.Ptr("Azure DevOps \\ Repos"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure DevOps \\ Test Plans"), + // ID: to.Ptr("Azure DevOps \\ Test Plans"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure DevTest Labs"), + // ID: to.Ptr("Azure DevTest Labs"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.devtestlab/labs")}, + // }, + // { + // DisplayName: to.Ptr("Azure Digital Twins"), + // ID: to.Ptr("Azure Digital Twins"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.digitaltwins/digitaltwinsinstances")}, + // }, + // { + // DisplayName: to.Ptr("Azure FarmBeats"), + // ID: to.Ptr("Azure FarmBeats"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure File Sync"), + // ID: to.Ptr("Azure File Sync"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Firewall"), + // ID: to.Ptr("Azure Firewall"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/azurefirewalls")}, + // }, + // { + // DisplayName: to.Ptr("Azure Firewall Manager"), + // ID: to.Ptr("Azure Firewall Manager"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/firewallpolicies")}, + // }, + // { + // DisplayName: to.Ptr("Azure Fluid Relay"), + // ID: to.Ptr("Azure Fluid Relay"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.fluidrelay/fluidrelayservers")}, + // }, + // { + // DisplayName: to.Ptr("Azure Frontdoor"), + // ID: to.Ptr("Azure Frontdoor"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/frontdoors")}, + // }, + // { + // DisplayName: to.Ptr("Azure Health Data Services"), + // ID: to.Ptr("Azure Health Data Services"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure HPC Cache"), + // ID: to.Ptr("Azure HPC Cache"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.storagecache/caches")}, + // }, + // { + // DisplayName: to.Ptr("Azure Information Protection"), + // ID: to.Ptr("Azure Information Protection"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Immersive Reader"), + // ID: to.Ptr("Azure Immersive Reader"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure IoT Hub"), + // ID: to.Ptr("Azure IoT Hub"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.devices/iothubs")}, + // }, + // { + // DisplayName: to.Ptr("Azure Key Vault Managed HSM"), + // ID: to.Ptr("Azure Key Vault Managed HSM"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Kubernetes Service (AKS)"), + // ID: to.Ptr("Azure Kubernetes Service (AKS)"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.containerservice/managedclusters")}, + // }, + // { + // DisplayName: to.Ptr("Azure Kubernetes Service On Azure Stack HCI"), + // ID: to.Ptr("Azure Kubernetes Service On Azure Stack HCI"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Lab Services"), + // ID: to.Ptr("Azure Lab Services"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Load Testing"), + // ID: to.Ptr("Azure Load Testing"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Managed Applications"), + // ID: to.Ptr("Azure Managed Applications"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Managed Instance for Apache Cassandra"), + // ID: to.Ptr("Azure Managed Instance for Apache Cassandra"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Maps"), + // ID: to.Ptr("Azure Maps"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.maps/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Azure Migrate"), + // ID: to.Ptr("Azure Migrate"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.migrate/migrateprojects")}, + // }, + // { + // DisplayName: to.Ptr("Azure Monitor"), + // ID: to.Ptr("Azure Monitor"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.alertsmanagement/alerts"), + // to.Ptr("microsoft.insights/scheduledqueryrules")}, + // }, + // { + // DisplayName: to.Ptr("Azure Netapp Files"), + // ID: to.Ptr("Azure Netapp Files"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.netapp/netappaccounts")}, + // }, + // { + // DisplayName: to.Ptr("Azure Network Function Manager - Device"), + // ID: to.Ptr("Azure Network Function Manager - Device"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.hybridnetwork/devices")}, + // }, + // { + // DisplayName: to.Ptr("Azure Network Function Manager - Network Function"), + // ID: to.Ptr("Azure Network Function Manager - Network Function"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.hybridnetwork/networkfunctions")}, + // }, + // { + // DisplayName: to.Ptr("Azure OpenAI Service"), + // ID: to.Ptr("Azure OpenAI Service"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Open Datasets"), + // ID: to.Ptr("Azure Open Datasets"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Orbital"), + // ID: to.Ptr("Azure Orbital"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Peering Service"), + // ID: to.Ptr("Azure Peering Service"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.peering/peeringservices")}, + // }, + // { + // DisplayName: to.Ptr("Azure Policy"), + // ID: to.Ptr("Azure Policy"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Private 5G Core"), + // ID: to.Ptr("Azure Private 5G Core"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Private Link"), + // ID: to.Ptr("Azure Private Link"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/privateendpoints"), + // to.Ptr("microsoft.network/privatelinkservices")}, + // }, + // { + // DisplayName: to.Ptr("Azure Purview"), + // ID: to.Ptr("Azure Purview"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.purview/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Azure Quantum"), + // ID: to.Ptr("Azure Quantum"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Red Hat OpenShift"), + // ID: to.Ptr("Azure Red Hat OpenShift"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Reservations"), + // ID: to.Ptr("Azure Reservations"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Resource Manager"), + // ID: to.Ptr("Azure Resource Manager"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Resource Mover"), + // ID: to.Ptr("Azure Resource Mover"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.migrate/movecollections")}, + // }, + // { + // DisplayName: to.Ptr("Azure Search"), + // ID: to.Ptr("Azure Search"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.search/searchservices")}, + // }, + // { + // DisplayName: to.Ptr("Azure Sentinel"), + // ID: to.Ptr("Azure Sentinel"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Metrics Advisor"), + // ID: to.Ptr("Azure Metrics Advisor"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure SignalR Service"), + // ID: to.Ptr("Azure SignalR Service"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.signalrservice/signalr")}, + // }, + // { + // DisplayName: to.Ptr("Azure Spatial Anchors"), + // ID: to.Ptr("Azure Spatial Anchors"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.mixedreality/spatialanchorsaccounts")}, + // }, + // { + // DisplayName: to.Ptr("Azure Sphere"), + // ID: to.Ptr("Azure Sphere"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Spring Cloud"), + // ID: to.Ptr("Azure Spring Cloud"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.appplatform/spring")}, + // }, + // { + // DisplayName: to.Ptr("Azure SQL Migration extension for Azure Data Studio powered by Azure Database Migration Service"), + // ID: to.Ptr("Azure SQL Migration extension for Azure Data Studio powered by Azure Database Migration Service"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datamigration/sqlmigrationservices")}, + // }, + // { + // DisplayName: to.Ptr("Azure Stack"), + // ID: to.Ptr("Azure Stack"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Stack Edge"), + // ID: to.Ptr("Azure Stack Edge"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Stack HCI"), + // ID: to.Ptr("Azure Stack HCI"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.azurestackhci/clusters")}, + // }, + // { + // DisplayName: to.Ptr("Azure Static Web Apps"), + // ID: to.Ptr("Azure Static Web Apps"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.web/staticsites")}, + // }, + // { + // DisplayName: to.Ptr("Azure Synapse Analytics"), + // ID: to.Ptr("Azure Synapse Analytics"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.sql/servers"), + // to.Ptr("microsoft.synapse/workspaces")}, + // }, + // { + // DisplayName: to.Ptr("Azure Video Analyzer"), + // ID: to.Ptr("Azure Video Analyzer"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Video Analyzer For Media"), + // ID: to.Ptr("Azure Video Analyzer For Media"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure VMware Solution"), + // ID: to.Ptr("Azure VMware Solution"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.avs/privateclouds"), + // to.Ptr("microsoft.avs/privateclouds/clusters")}, + // }, + // { + // DisplayName: to.Ptr("Azure VMware Solution by CloudSimple"), + // ID: to.Ptr("Azure VMware Solution by CloudSimple"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Web PubSub"), + // ID: to.Ptr("Azure Web PubSub"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Recovery Services vault"), + // ID: to.Ptr("Recovery Services vault"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.recoveryservices/vaults")}, + // }, + // { + // DisplayName: to.Ptr("Backup vault"), + // ID: to.Ptr("Backup vault"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.dataprotection/backupvaults")}, + // }, + // { + // DisplayName: to.Ptr("Batch"), + // ID: to.Ptr("Batch"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.batch/batchaccounts")}, + // }, + // { + // DisplayName: to.Ptr("BareMetal Infrastructure"), + // ID: to.Ptr("BareMetal Infrastructure"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.baremetalinfrastructure/baremetalinstances")}, + // }, + // { + // DisplayName: to.Ptr("CDN"), + // ID: to.Ptr("CDN"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.cdn/profiles")}, + // }, + // { + // DisplayName: to.Ptr("Change Analysis"), + // ID: to.Ptr("Change Analysis"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cloud Services"), + // ID: to.Ptr("Cloud Services"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.classiccompute/domainnames"), + // to.Ptr("microsoft.compute/domainnames")}, + // }, + // { + // DisplayName: to.Ptr("Cloud Shell"), + // ID: to.Ptr("Cloud Shell"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Anomaly Detector\""), + // ID: to.Ptr("Cognitive Services \\ Anomaly Detector"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Azure Metrics Advisor"), + // ID: to.Ptr("Cognitive Services \\ Azure Metrics Advisor"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Bing Autosuggest API"), + // ID: to.Ptr("Cognitive Services \\ Bing Autosuggest API"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.cognitiveservices/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Bing Search API"), + // ID: to.Ptr("Cognitive Services \\ Bing Search API"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.cognitiveservices/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Bing Speech API"), + // ID: to.Ptr("Cognitive Services \\ Bing Speech API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Bing Spell Check API"), + // ID: to.Ptr("Cognitive Services \\ Bing Spell Check API"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.cognitiveservices/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Bing Video Search API"), + // ID: to.Ptr("Cognitive Services \\ Bing Video Search API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Bing Visual Search API"), + // ID: to.Ptr("Cognitive Services \\ Bing Visual Search API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Bing Web Search API"), + // ID: to.Ptr("Cognitive Services \\ Bing Web Search API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Computer Vision API"), + // ID: to.Ptr("Cognitive Services \\ Computer Vision API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Content Moderator API"), + // ID: to.Ptr("Cognitive Services \\ Content Moderator API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Custom Vision API"), + // ID: to.Ptr("Cognitive Services \\ Custom Vision API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Face API"), + // ID: to.Ptr("Cognitive Services \\ Face API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Form Recognizer API"), + // ID: to.Ptr("Cognitive Services \\ Form Recognizer API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Azure Form Recognizer"), + // ID: to.Ptr("Cognitive Services \\ Azure Form Recognizer"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Image Search API"), + // ID: to.Ptr("Cognitive Services \\ Image Search API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Language Understanding (LUIS)"), + // ID: to.Ptr("Cognitive Services \\ Language Understanding (LUIS)"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ News Search API"), + // ID: to.Ptr("Cognitive Services \\ News Search API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Personalizer API"), + // ID: to.Ptr("Cognitive Services \\ Personalizer API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ QnA Maker API"), + // ID: to.Ptr("Cognitive Services \\ QnA Maker API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Speech Services API"), + // ID: to.Ptr("Cognitive Services \\ Speech Services API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Speaker Recognition API"), + // ID: to.Ptr("Cognitive Services \\ Speaker Recognition API"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Text Analytics API"), + // ID: to.Ptr("Cognitive Services \\ Text Analytics API"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.cognitiveservices/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Translator Speech API"), + // ID: to.Ptr("Cognitive Services \\ Translator Speech API"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.cognitiveservices/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Cognitive Services \\ Translator Text API"), + // ID: to.Ptr("Cognitive Services \\ Translator Text API"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.cognitiveservices/accounts")}, + // }, + // { + // DisplayName: to.Ptr("Container Instances"), + // ID: to.Ptr("Container Instances"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.containerinstance/containergroups")}, + // }, + // { + // DisplayName: to.Ptr("Container Registry"), + // ID: to.Ptr("Container Registry"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.containerregistry/registries")}, + // }, + // { + // DisplayName: to.Ptr("Cost Management"), + // ID: to.Ptr("Cost Management"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Data Catalog"), + // ID: to.Ptr("Data Catalog"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datacatalog/catalogs")}, + // }, + // { + // DisplayName: to.Ptr("Data Factory"), + // ID: to.Ptr("Data Factory"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datafactory/datafactories")}, + // }, + // { + // DisplayName: to.Ptr("Data Factory V1"), + // ID: to.Ptr("Data Factory V1"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datafactory/datafactories")}, + // }, + // { + // DisplayName: to.Ptr("Data Factory V2"), + // ID: to.Ptr("Data Factory V2"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datafactory/factories")}, + // }, + // { + // DisplayName: to.Ptr("Data Factory V2 \\ SSIS Integration Runtime"), + // ID: to.Ptr("Data Factory V2 \\ SSIS Integration Runtime"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datafactory/factories")}, + // }, + // { + // DisplayName: to.Ptr("Data Factory \\ Azure Integration Runtime"), + // ID: to.Ptr("Data Factory \\ Azure Integration Runtime"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datafactory/datafactories")}, + // }, + // { + // DisplayName: to.Ptr("Data Lake Analytics"), + // ID: to.Ptr("Data Lake Analytics"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.datalakeanalytics/accounts"), + // to.Ptr("microsoft.datalakeanalytics/accounts/storageaccounts")}, + // }, + // { + // DisplayName: to.Ptr("Diagnostic Logs"), + // ID: to.Ptr("Diagnostic Logs"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Event Grid"), + // ID: to.Ptr("Event Grid"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.eventgrid/topics")}, + // }, + // { + // DisplayName: to.Ptr("Event Hubs"), + // ID: to.Ptr("Event Hubs"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.eventhub/namespaces")}, + // }, + // { + // DisplayName: to.Ptr("ExpressRoute"), + // ID: to.Ptr("ExpressRoute"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/expressroutecircuits")}, + // }, + // { + // DisplayName: to.Ptr("ExpressRoute \\ ExpressRoute Circuits"), + // ID: to.Ptr("ExpressRoute \\ ExpressRoute Circuits"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/expressroutecircuits")}, + // }, + // { + // DisplayName: to.Ptr("ExpressRoute \\ ExpressRoute Gateways"), + // ID: to.Ptr("ExpressRoute \\ ExpressRoute Gateways"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Functions"), + // ID: to.Ptr("Functions"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.web/sites")}, + // }, + // { + // DisplayName: to.Ptr("HDInsight"), + // ID: to.Ptr("HDInsight"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.hdinsight/clusters")}, + // }, + // { + // DisplayName: to.Ptr("Health Bot"), + // ID: to.Ptr("Health Bot"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("HockeyApp"), + // ID: to.Ptr("HockeyApp"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Internet Analyzer"), + // ID: to.Ptr("Internet Analyzer"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/networkexperiment")}, + // }, + // { + // DisplayName: to.Ptr("IoT Central"), + // ID: to.Ptr("IoT Central"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.iotcentral/iotapps")}, + // }, + // { + // DisplayName: to.Ptr("IoT Hub \\ IoT Hub Device Provisioning Service"), + // ID: to.Ptr("IoT Hub \\ IoT Hub Device Provisioning Service"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Key Vault"), + // ID: to.Ptr("Key Vault"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.keyvault/vaults")}, + // }, + // { + // DisplayName: to.Ptr("Load Balancer"), + // ID: to.Ptr("Load Balancer"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/loadbalancers")}, + // }, + // { + // DisplayName: to.Ptr("Log Analytics"), + // ID: to.Ptr("Log Analytics"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.operationalinsights/workspaces")}, + // }, + // { + // DisplayName: to.Ptr("Logic Apps"), + // ID: to.Ptr("Logic Apps"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.logic/workflows")}, + // }, + // { + // DisplayName: to.Ptr("Machine Learning Services"), + // ID: to.Ptr("Machine Learning Services"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.machinelearning/workspaces"), + // to.Ptr("microsoft.machinelearning/commitmentplans"), + // to.Ptr("microsoft.machinelearning/webservices")}, + // }, + // { + // DisplayName: to.Ptr("Machine Learning Services \\ Machine Learning Experimentation Service"), + // ID: to.Ptr("Machine Learning Services \\ Machine Learning Experimentation Service"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Machine Learning Services \\ Machine Learning Model Management"), + // ID: to.Ptr("Machine Learning Services \\ Machine Learning Model Management"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Machine Learning Studio"), + // ID: to.Ptr("Machine Learning Studio"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("MariaDB"), + // ID: to.Ptr("MariaDB"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.dbformariadb/servers")}, + // }, + // { + // DisplayName: to.Ptr("Marketplace"), + // ID: to.Ptr("Marketplace"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Media Services \\ Encoding"), + // ID: to.Ptr("Media Services \\ Encoding"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.media/mediaservices")}, + // }, + // { + // DisplayName: to.Ptr("Media Services \\ Streaming"), + // ID: to.Ptr("Media Services \\ Streaming"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.media/mediaservices")}, + // }, + // { + // DisplayName: to.Ptr("Microsoft Azure Attestation"), + // ID: to.Ptr("Microsoft Azure Attestation"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Microsoft Azure portal"), + // ID: to.Ptr("Microsoft Azure portal"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Microsoft Azure portal \\ Marketplace"), + // ID: to.Ptr("Microsoft Azure portal \\ Marketplace"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Microsoft Defender for Cloud"), + // ID: to.Ptr("Microsoft Defender for Cloud"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Microsoft Defender for IoT"), + // ID: to.Ptr("Microsoft Defender for IoT"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Microsoft Entra Permissions Management"), + // ID: to.Ptr("Microsoft Entra Permissions Management"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Microsoft Genomics"), + // ID: to.Ptr("Microsoft Genomics"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Mobile Engagement"), + // ID: to.Ptr("Mobile Engagement"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Multi-Factor Authentication"), + // ID: to.Ptr("Multi-Factor Authentication"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Network Infrastructure"), + // ID: to.Ptr("Network Infrastructure"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Network Watcher"), + // ID: to.Ptr("Network Watcher"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Notification Hubs"), + // ID: to.Ptr("Notification Hubs"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.notificationhubs/namespaces")}, + // }, + // { + // DisplayName: to.Ptr("Power BI Embedded"), + // ID: to.Ptr("Power BI Embedded"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.powerbi/workspacecollections"), + // to.Ptr("microsoft.powerbidedicated/capacities")}, + // }, + // { + // DisplayName: to.Ptr("Redis Cache"), + // ID: to.Ptr("Redis Cache"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.cache/redis")}, + // }, + // { + // DisplayName: to.Ptr("Remote Rendering"), + // ID: to.Ptr("Remote Rendering"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.mixedreality/remoterenderingaccounts")}, + // }, + // { + // DisplayName: to.Ptr("SAP HANA on Azure Large Instances"), + // ID: to.Ptr("SAP HANA on Azure Large Instances"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.hanaonazure/hanainstances")}, + // }, + // { + // DisplayName: to.Ptr("SQL Data Warehouse"), + // ID: to.Ptr("SQL Data Warehouse"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.sql/servers/databases")}, + // }, + // { + // DisplayName: to.Ptr("SQL Database"), + // ID: to.Ptr("SQL Database"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.sql/servers"), + // to.Ptr("microsoft.sql/servers/databases"), + // to.Ptr("microsoft.sql/servers/elasticpools")}, + // }, + // { + // DisplayName: to.Ptr("SQL Managed Instance"), + // ID: to.Ptr("SQL Managed Instance"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.sql/managedinstances/databases"), + // to.Ptr("microsoft.sql/managedinstances")}, + // }, + // { + // DisplayName: to.Ptr("SQL Server on Azure Virtual Machines"), + // ID: to.Ptr("SQL Server on Azure Virtual Machines"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.sqlvirtualmachine/sqlvirtualmachines")}, + // }, + // { + // DisplayName: to.Ptr("SQL Server Stretch Database"), + // ID: to.Ptr("SQL Server Stretch Database"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Scheduler"), + // ID: to.Ptr("Scheduler"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.scheduler/jobcollections")}, + // }, + // { + // DisplayName: to.Ptr("Security Center"), + // ID: to.Ptr("Security Center"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Service Bus"), + // ID: to.Ptr("Service Bus"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.servicebus/namespaces")}, + // }, + // { + // DisplayName: to.Ptr("Service Fabric"), + // ID: to.Ptr("Service Fabric"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.servicefabric/clusters")}, + // }, + // { + // DisplayName: to.Ptr("Site Recovery"), + // ID: to.Ptr("Site Recovery"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.recoveryservices/vaults")}, + // }, + // { + // DisplayName: to.Ptr("StorSimple"), + // ID: to.Ptr("StorSimple"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.storsimple/managers"), + // to.Ptr("microsoft.storsimplebvtd2/managers")}, + // }, + // { + // DisplayName: to.Ptr("Storage"), + // ID: to.Ptr("Storage"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.classicstorage/storageaccounts"), + // to.Ptr("microsoft.storage/storageaccounts")}, + // }, + // { + // DisplayName: to.Ptr("Stream Analytics"), + // ID: to.Ptr("Stream Analytics"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.streamanalytics/streamingjobs")}, + // }, + // { + // DisplayName: to.Ptr("Subscription Management"), + // ID: to.Ptr("Subscription Management"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Time Series Insights"), + // ID: to.Ptr("Time Series Insights"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Traffic Manager"), + // ID: to.Ptr("Traffic Manager"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/trafficmanagerprofiles")}, + // }, + // { + // DisplayName: to.Ptr("VPN Gateway"), + // ID: to.Ptr("VPN Gateway"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/virtualnetworkgateways"), + // to.Ptr("microsoft.network/connections")}, + // }, + // { + // DisplayName: to.Ptr("VPN Gateway \\ Virtual WAN"), + // ID: to.Ptr("VPN Gateway \\ Virtual WAN"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Virtual Machine Scale Sets"), + // ID: to.Ptr("Virtual Machine Scale Sets"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.compute/virtualmachinescalesets")}, + // }, + // { + // DisplayName: to.Ptr("Virtual Machines"), + // ID: to.Ptr("Virtual Machines"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.classiccompute/virtualmachines"), + // to.Ptr("microsoft.compute/virtualmachines")}, + // }, + // { + // DisplayName: to.Ptr("Virtual Network"), + // ID: to.Ptr("Virtual Network"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.network/virtualnetworks"), + // to.Ptr("microsoft.classicnetwork/virtualnetworks")}, + // }, + // { + // DisplayName: to.Ptr("Windows 10 IoT Core Services"), + // ID: to.Ptr("Windows 10 IoT Core Services"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Windows Virtual Desktop"), + // ID: to.Ptr("Windows Virtual Desktop"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.desktopvirtualization/hostpools")}, + // }, + // { + // DisplayName: to.Ptr("Azure Automanage"), + // ID: to.Ptr("Azure Automanage"), + // ResourceTypes: []*string{ + // to.Ptr("microsoft.automanage/configurationprofiles"), + // to.Ptr("microsoft.compute/virtualmachines/providers/configurationprofileassignments"), + // to.Ptr("microsoft.hybridcompute/machines/providers/configurationprofileassignments"), + // to.Ptr("microsoft.Azurestackhci/clusters/providers/configurationprofileassignments")}, + // }, + // { + // DisplayName: to.Ptr("Microsoft Graph"), + // ID: to.Ptr("Microsoft Graph"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure confidential ledger"), + // ID: to.Ptr("Azure confidential ledger"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Managed Grafana"), + // ID: to.Ptr("Azure Managed Grafana"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Universal Print"), + // ID: to.Ptr("Universal Print"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Applied AI Services \\ Azure Video Indexer"), + // ID: to.Ptr("Azure Applied AI Services \\ Azure Video Indexer"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Azure Route Server"), + // ID: to.Ptr("Azure Route Server"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Virtual Network NAT"), + // ID: to.Ptr("Virtual Network NAT"), + // ResourceTypes: []*string{ + // }, + // }, + // { + // DisplayName: to.Ptr("Microsoft Defender External Attack Surface Management"), + // ID: to.Ptr("Microsoft Defender External Attack Surface Management"), + // ResourceTypes: []*string{ + // }, + // }}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json +func ExampleMetadataClient_GetEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMetadataClient().GetEntity(ctx, "status", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MetadataEntity = armresourcehealth.MetadataEntity{ + // Name: to.Ptr("status"), + // Type: to.Ptr("Microsoft.ResourceHealth/metadata"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/metadata/status"), + // Properties: &armresourcehealth.MetadataEntityProperties{ + // ApplicableScenarios: []*armresourcehealth.Scenario{ + // to.Ptr(armresourcehealth.ScenarioAlerts)}, + // DisplayName: to.Ptr("Status"), + // SupportedValues: []*armresourcehealth.MetadataSupportedValueDetail{ + // { + // DisplayName: to.Ptr("Active"), + // ID: to.Ptr("Active"), + // }, + // { + // DisplayName: to.Ptr("Resolved"), + // ID: to.Ptr("Resolved"), + // }, + // { + // DisplayName: to.Ptr("In Progress"), + // ID: to.Ptr("In Progress"), + // }, + // { + // DisplayName: to.Ptr("Updated"), + // ID: to.Ptr("Updated"), + // }}, + // }, + // } +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/models.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/models.go index b5dea7c6cca5..89d727761f3f 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/models.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/models.go @@ -14,102 +14,113 @@ import "time" // AvailabilityStatus - availabilityStatus of a resource. type AvailabilityStatus struct { // Azure Resource Manager Identity for the availabilityStatuses resource. - ID *string `json:"id,omitempty"` + ID *string // Azure Resource Manager geo location of the resource. - Location *string `json:"location,omitempty"` + Location *string // current. - Name *string `json:"name,omitempty"` + Name *string // Properties of availability state. - Properties *AvailabilityStatusProperties `json:"properties,omitempty"` + Properties *AvailabilityStatusProperties // Microsoft.ResourceHealth/AvailabilityStatuses. - Type *string `json:"type,omitempty"` + Type *string } // AvailabilityStatusListResult - The List availabilityStatus operation response. type AvailabilityStatusListResult struct { // REQUIRED; The list of availabilityStatuses. - Value []*AvailabilityStatus `json:"value,omitempty"` + Value []*AvailabilityStatus // The URI to fetch the next page of availabilityStatuses. Call ListNext() with this URI to fetch the next page of availabilityStatuses. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string } // AvailabilityStatusProperties - Properties of availability state. type AvailabilityStatusProperties struct { + // The Article Id + ArticleID *string + // Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting // event - AvailabilityState *AvailabilityStateValues `json:"availabilityState,omitempty"` + AvailabilityState *AvailabilityStateValues + + // When a context field is set to Platform, this field will reflect if the event was planned or unplanned. If the context + // field does not have a value of Platform, then this field will be ignored. + Category *string + + // When an event is created, it can either be triggered by a customer or the platform of the resource and this field will + // illustrate that. This field is connected to the category field in this object. + Context *string // Details of the availability status. - DetailedStatus *string `json:"detailedStatus,omitempty"` + DetailedStatus *string // In case of an availability impacting event, it describes the category of a PlatformInitiated health impacting event. Examples // are Planned, Unplanned etc. - HealthEventCategory *string `json:"healthEventCategory,omitempty"` + HealthEventCategory *string // In case of an availability impacting event, it describes where the health impacting event was originated. Examples are // PlatformInitiated, UserInitiated etc. - HealthEventCause *string `json:"healthEventCause,omitempty"` + HealthEventCause *string // It is a unique Id that identifies the event - HealthEventID *string `json:"healthEventId,omitempty"` + HealthEventID *string // In case of an availability impacting event, it describes when the health impacting event was originated. Examples are Lifecycle, // Downtime, Fault Analysis etc. - HealthEventType *string `json:"healthEventType,omitempty"` + HealthEventType *string // Timestamp for when last change in health status occurred. - OccurredTime *time.Time `json:"occurredTime,omitempty"` + OccurredTime *time.Time // Chronicity of the availability transition. - ReasonChronicity *ReasonChronicityTypes `json:"reasonChronicity,omitempty"` + ReasonChronicity *ReasonChronicityTypes // When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. Examples // are planned, unplanned, user initiated or an outage etc. - ReasonType *string `json:"reasonType,omitempty"` + ReasonType *string // An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned - RecentlyResolved *AvailabilityStatusPropertiesRecentlyResolved `json:"recentlyResolved,omitempty"` + RecentlyResolved *AvailabilityStatusPropertiesRecentlyResolved // Lists actions the user can take based on the current availabilityState of the resource. - RecommendedActions []*RecommendedAction `json:"recommendedActions,omitempty"` + RecommendedActions []*RecommendedAction // Timestamp for when the health was last checked. - ReportedTime *time.Time `json:"reportedTime,omitempty"` + ReportedTime *time.Time // When the resource's availabilityState is Unavailable and the reasonType is not User Initiated, it provides the date and // time for when the issue is expected to be resolved. - ResolutionETA *time.Time `json:"resolutionETA,omitempty"` + ResolutionETA *time.Time // When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was // received. - RootCauseAttributionTime *time.Time `json:"rootCauseAttributionTime,omitempty"` + RootCauseAttributionTime *time.Time // Lists the service impacting events that may be affecting the health of the resource. - ServiceImpactingEvents []*ServiceImpactingEvent `json:"serviceImpactingEvents,omitempty"` + ServiceImpactingEvents []*ServiceImpactingEvent // Summary description of the availability status. - Summary *string `json:"summary,omitempty"` + Summary *string // Title description of the availability status. - Title *string `json:"title,omitempty"` + Title *string } // AvailabilityStatusPropertiesRecentlyResolved - An annotation describing a change in the availabilityState to Available // from Unavailable with a reasonType of type Unplanned type AvailabilityStatusPropertiesRecentlyResolved struct { // Timestamp when the availabilityState changes to Available. - ResolvedTime *time.Time `json:"resolvedTime,omitempty"` + ResolvedTime *time.Time // Brief description of cause of the resource becoming unavailable. - UnavailabilitySummary *string `json:"unavailabilitySummary,omitempty"` + UnavailabilitySummary *string // Timestamp for when the availabilityState changed to Unavailable - UnavailableOccurredTime *time.Time `json:"unavailableOccurredTime,omitempty"` + UnavailableOccurredTime *time.Time } // AvailabilityStatusesClientGetByResourceOptions contains the optional parameters for the AvailabilityStatusesClient.GetByResource @@ -148,94 +159,552 @@ type AvailabilityStatusesClientListOptions struct { Filter *string } -// ErrorResponse - Error details. -type ErrorResponse struct { - // The error object. - Error *ErrorResponseError `json:"error,omitempty"` +// ChildAvailabilityStatusesClientGetByResourceOptions contains the optional parameters for the ChildAvailabilityStatusesClient.GetByResource +// method. +type ChildAvailabilityStatusesClientGetByResourceOptions struct { + // Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + Expand *string + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string +} + +// ChildAvailabilityStatusesClientListOptions contains the optional parameters for the ChildAvailabilityStatusesClient.NewListPager +// method. +type ChildAvailabilityStatusesClientListOptions struct { + // Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + Expand *string + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string +} + +// ChildResourcesClientListOptions contains the optional parameters for the ChildResourcesClient.NewListPager method. +type ChildResourcesClientListOptions struct { + // Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + Expand *string + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string +} + +// EmergingIssue - On-going emerging issue from azure status. +type EmergingIssue struct { + // Timestamp for when last time refreshed for ongoing emerging issue. + RefreshTimestamp *time.Time + + // The list of emerging issues of active event type. + StatusActiveEvents []*StatusActiveEvent + + // The list of emerging issues of banner type. + StatusBanners []*StatusBanner +} + +// EmergingIssueImpact - Object of the emerging issue impact on services and regions. +type EmergingIssueImpact struct { + // The impacted service id. + ID *string + + // The impacted service name. + Name *string + + // The list of impacted regions for corresponding emerging issues. + Regions []*ImpactedRegion +} + +// EmergingIssueListResult - The list of emerging issues. +type EmergingIssueListResult struct { + // The link used to get the next page of emerging issues. + NextLink *string + + // The list of emerging issues. + Value []*EmergingIssuesGetResult +} + +// EmergingIssuesClientGetOptions contains the optional parameters for the EmergingIssuesClient.Get method. +type EmergingIssuesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EmergingIssuesClientListOptions contains the optional parameters for the EmergingIssuesClient.NewListPager method. +type EmergingIssuesClientListOptions struct { + // placeholder for future optional parameters +} + +// EmergingIssuesGetResult - The Get EmergingIssues operation response. +type EmergingIssuesGetResult struct { + // The emerging issue entity properties. + Properties *EmergingIssue + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// ErrorResponseError - The error object. -type ErrorResponseError struct { - // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` +// Event - Service health event +type Event struct { + // Properties of event. + Properties *EventProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; The error details. - Details *string `json:"details,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EventClientFetchDetailsBySubscriptionIDAndTrackingIDOptions contains the optional parameters for the EventClient.FetchDetailsBySubscriptionIDAndTrackingID +// method. +type EventClientFetchDetailsBySubscriptionIDAndTrackingIDOptions struct { + // placeholder for future optional parameters +} + +// EventClientFetchDetailsByTenantIDAndTrackingIDOptions contains the optional parameters for the EventClient.FetchDetailsByTenantIDAndTrackingID +// method. +type EventClientFetchDetailsByTenantIDAndTrackingIDOptions struct { + // placeholder for future optional parameters +} + +// EventClientGetBySubscriptionIDAndTrackingIDOptions contains the optional parameters for the EventClient.GetBySubscriptionIDAndTrackingID +// method. +type EventClientGetBySubscriptionIDAndTrackingIDOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string + // Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR + // queryStartTime=7%2F24%2F2020 + QueryStartTime *string +} + +// EventClientGetByTenantIDAndTrackingIDOptions contains the optional parameters for the EventClient.GetByTenantIDAndTrackingID +// method. +type EventClientGetByTenantIDAndTrackingIDOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string + // Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR + // queryStartTime=7%2F24%2F2020 + QueryStartTime *string +} + +// EventImpactedResource - Impacted resource for an event. +type EventImpactedResource struct { + // Properties of impacted resource. + Properties *EventImpactedResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EventImpactedResourceListResult - The List of eventImpactedResources operation response. +type EventImpactedResourceListResult struct { + // REQUIRED; The list of eventImpactedResources. + Value []*EventImpactedResource + + // The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of impacted resource. + NextLink *string +} + +// EventImpactedResourceProperties - Properties of impacted resource. +type EventImpactedResourceProperties struct { + // Additional information. + Info []*KeyValueItem + + // READ-ONLY; Impacted resource region name. + TargetRegion *string + + // READ-ONLY; Identity for resource within Microsoft cloud. + TargetResourceID *string + + // READ-ONLY; Resource type within Microsoft cloud. + TargetResourceType *string +} + +// EventProperties - Properties of event. +type EventProperties struct { + // Additional information + AdditionalInformation *EventPropertiesAdditionalInformation + + // Article of event. + Article *EventPropertiesArticle + + // Contains the communication message for the event, that could include summary, root cause and other details. + Description *string + + // duration in seconds + Duration *int32 + + // Tells if we want to enable or disable Microsoft Support for this event. + EnableChatWithUs *bool + + // Tells if we want to enable or disable Microsoft Support for this event. + EnableMicrosoftSupport *bool + + // Level of event. + EventLevel *EventLevelValues + + // Source of event. + EventSource *EventSourceValues + + // Type of event. + EventType *EventTypeValues + + // The id of the Incident + ExternalIncidentID *string + + // Frequently asked questions for the service health event. + Faqs []*Faq + + // Header text of event. + Header *string + + // Stage for HIR Document + HirStage *string + + // List services impacted by the service health event. + Impact []*Impact + + // It provides the Timestamp for when the health impacting event resolved. + ImpactMitigationTime *time.Time + + // It provides the Timestamp for when the health impacting event started. + ImpactStartTime *time.Time + + // The type of the impact + ImpactType *string + + // It provides information if the event is High incident rate event or not. + IsHIR *bool + + // It provides the Timestamp for when the health impacting event was last updated. + LastUpdateTime *time.Time + + // Level of insight. + Level *LevelValues + + // Useful links of event. + Links []*Link + + // Is true if the event is platform initiated. + PlatformInitiated *bool + + // 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. + Priority *int32 + + // The reason for the Incident + Reason *string + + // Recommended actions of event. + RecommendedActions *EventPropertiesRecommendedActions + + // Current status of event. + Status *EventStatusValues + + // Summary text of event. + Summary *string + + // Title text of event. + Title *string +} + +// EventPropertiesAdditionalInformation - Additional information +type EventPropertiesAdditionalInformation struct { + // Additional information Message + Message *string +} + +// EventPropertiesArticle - Article of event. +type EventPropertiesArticle struct { + // Article content of event. + ArticleContent *string + + // Article Id + ArticleID *string + + // It provides a map of parameter name and value + Parameters any +} + +// EventPropertiesRecommendedActions - Recommended actions of event. +type EventPropertiesRecommendedActions struct { + // Recommended actions for the service health event. + Actions []*EventPropertiesRecommendedActionsItem + + // Recommended action locale for the service health event. + LocaleCode *string + + // Recommended action title for the service health event. + Message *string +} + +// EventPropertiesRecommendedActionsItem - Recommended action for the service health event. +type EventPropertiesRecommendedActionsItem struct { + // Recommended action text + ActionText *string + + // Recommended action group Id for the service health event. + GroupID *int32 +} + +// Events - The List events operation response. +type Events struct { + // REQUIRED; The list of event. + Value []*Event + + // The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of events. + NextLink *string +} + +// EventsClientListBySingleResourceOptions contains the optional parameters for the EventsClient.NewListBySingleResourcePager +// method. +type EventsClientListBySingleResourceOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string +} + +// EventsClientListBySubscriptionIDOptions contains the optional parameters for the EventsClient.NewListBySubscriptionIDPager +// method. +type EventsClientListBySubscriptionIDOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string + // Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR + // queryStartTime=7%2F24%2F2020 + QueryStartTime *string +} + +// EventsClientListByTenantIDOptions contains the optional parameters for the EventsClient.NewListByTenantIDPager method. +type EventsClientListByTenantIDOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string + // Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR + // queryStartTime=7%2F24%2F2020 + QueryStartTime *string +} + +// Faq - Frequently asked question for the service health event +type Faq struct { + // FAQ answer for the service health event. + Answer *string + + // FAQ locale for the service health event. + LocaleCode *string + + // FAQ question for the service health event. + Question *string +} + +// Impact - Azure service impacted by the service health event. +type Impact struct { + // List regions impacted by the service health event. + ImpactedRegions []*ImpactedServiceRegion + + // Impacted service name. + ImpactedService *string } // ImpactedRegion - Object of impacted region. type ImpactedRegion struct { // The impacted region id. - ID *string `json:"id,omitempty"` + ID *string // The impacted region name. - Name *string `json:"name,omitempty"` + Name *string +} + +// ImpactedResourcesClientGetByTenantIDOptions contains the optional parameters for the ImpactedResourcesClient.GetByTenantID +// method. +type ImpactedResourcesClientGetByTenantIDOptions struct { + // placeholder for future optional parameters +} + +// ImpactedResourcesClientGetOptions contains the optional parameters for the ImpactedResourcesClient.Get method. +type ImpactedResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ImpactedResourcesClientListBySubscriptionIDAndEventIDOptions contains the optional parameters for the ImpactedResourcesClient.NewListBySubscriptionIDAndEventIDPager +// method. +type ImpactedResourcesClientListBySubscriptionIDAndEventIDOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string +} + +// ImpactedResourcesClientListByTenantIDAndEventIDOptions contains the optional parameters for the ImpactedResourcesClient.NewListByTenantIDAndEventIDPager +// method. +type ImpactedResourcesClientListByTenantIDAndEventIDOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string +} + +// ImpactedServiceRegion - Azure region impacted by the service health event. +type ImpactedServiceRegion struct { + // Impacted region name. + ImpactedRegion *string + + // List subscription impacted by the service health event. + ImpactedSubscriptions []*string + + // List tenant impacted by the service health event. + ImpactedTenants []*string + + // It provides the Timestamp for when the last update for the service health event. + LastUpdateTime *time.Time + + // Current status of event in the region. + Status *EventStatusValues + + // List of updates for given service health event. + Updates []*Update +} + +// KeyValueItem - Key value tuple. +type KeyValueItem struct { + // READ-ONLY; Key of tuple. + Key *string + + // READ-ONLY; Value of tuple. + Value *string +} + +// Link - Useful links for service health event. +type Link struct { + // It provides the name of portal extension blade to produce link for given service health event. + BladeName *string + + // Display text of link. + DisplayText *LinkDisplayText + + // It provides the name of portal extension to produce link for given service health event. + ExtensionName *string + + // It provides a map of parameter name and value for portal extension blade to produce lik for given service health event. + Parameters any + + // Type of link. + Type *LinkTypeValues +} + +// LinkDisplayText - Display text of link. +type LinkDisplayText struct { + // Localized display text of link. + LocalizedValue *string + + // Display text of link. + Value *string +} + +// MetadataClientGetEntityOptions contains the optional parameters for the MetadataClient.GetEntity method. +type MetadataClientGetEntityOptions struct { + // placeholder for future optional parameters +} + +// MetadataClientListOptions contains the optional parameters for the MetadataClient.NewListPager method. +type MetadataClientListOptions struct { + // placeholder for future optional parameters } -// ImpactedResourceStatus - impactedResource with health status -type ImpactedResourceStatus struct { - // Properties of impacted resource status. - Properties *ImpactedResourceStatusProperties `json:"properties,omitempty"` +// MetadataEntity - The metadata entity contract. +type MetadataEntity struct { + // The metadata entity properties. + Properties *MetadataEntityProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// ImpactedResourceStatusProperties - Properties of impacted resource status. -type ImpactedResourceStatusProperties struct { - // Impacted resource status of the resource. - AvailabilityState *AvailabilityStateValues `json:"availabilityState,omitempty"` +// MetadataEntityListResult - The list of metadata entities +type MetadataEntityListResult struct { + // The link used to get the next page of metadata. + NextLink *string - // Timestamp for when last change in health status occurred. - OccurredTime *time.Time `json:"occurredTime,omitempty"` + // The list of metadata entities. + Value []*MetadataEntity +} + +// MetadataEntityProperties - The metadata entity properties +type MetadataEntityProperties struct { + // The list of scenarios applicable to this metadata entity. + ApplicableScenarios []*Scenario - // When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. - ReasonType *ReasonTypeValues `json:"reasonType,omitempty"` + // The list of keys on which this entity depends on. + DependsOn []*string - // Summary description of the impacted resource status. - Summary *string `json:"summary,omitempty"` + // The display name. + DisplayName *string - // Title description of the impacted resource status. - Title *string `json:"title,omitempty"` + // The list of supported values. + SupportedValues []*MetadataSupportedValueDetail } -// Operation available in the resourcehealth resource provider. +// MetadataSupportedValueDetail - The metadata supported value detail. +type MetadataSupportedValueDetail struct { + // The display name. + DisplayName *string + + // The id. + ID *string + + // The list of associated resource types. + ResourceTypes []*string +} + +// Operation available in the Microsoft.ResourceHealth resource provider. type Operation struct { // Properties of the operation. - Display *OperationDisplay `json:"display,omitempty"` + Display *OperationDisplay // Name of the operation. - Name *string `json:"name,omitempty"` + Name *string } // OperationDisplay - Properties of the operation. type OperationDisplay struct { // Description of the operation. - Description *string `json:"description,omitempty"` + Description *string // Operation name. - Operation *string `json:"operation,omitempty"` + Operation *string // Provider name. - Provider *string `json:"provider,omitempty"` + Provider *string // Resource name. - Resource *string `json:"resource,omitempty"` + Resource *string } // OperationListResult - Lists the operations response. type OperationListResult struct { - // REQUIRED; List of operations available in the resourcehealth resource provider. - Value []*Operation `json:"value,omitempty"` + // REQUIRED; List of operations available in the Microsoft.ResourceHealth resource provider. + Value []*Operation } // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. @@ -246,77 +715,145 @@ type OperationsClientListOptions struct { // RecommendedAction - Lists actions the user can take based on the current availabilityState of the resource. type RecommendedAction struct { // Recommended action. - Action *string `json:"action,omitempty"` + Action *string // Link to the action - ActionURL *string `json:"actionUrl,omitempty"` + ActionURL *string - // Substring of action, it describes which text should host the action url. - ActionURLText *string `json:"actionUrlText,omitempty"` -} + // the comment for the Action + ActionURLComment *string -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // Substring of action, it describes which text should host the action URL. + ActionURLText *string +} - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` +// SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDOptions contains the optional parameters for the SecurityAdvisoryImpactedResourcesClient.NewListBySubscriptionIDAndEventIDPager +// method. +type SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string +} - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` +// SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDOptions contains the optional parameters for the SecurityAdvisoryImpactedResourcesClient.NewListByTenantIDAndEventIDPager +// method. +type SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDOptions struct { + // The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN + Filter *string } // ServiceImpactingEvent - Lists the service impacting events that may be affecting the health of the resource. type ServiceImpactingEvent struct { // Correlation id for the event - CorrelationID *string `json:"correlationId,omitempty"` + CorrelationID *string // Timestamp for when the event started. - EventStartTime *time.Time `json:"eventStartTime,omitempty"` + EventStartTime *time.Time // Timestamp for when event was submitted/detected. - EventStatusLastModifiedTime *time.Time `json:"eventStatusLastModifiedTime,omitempty"` + EventStatusLastModifiedTime *time.Time // Properties of the service impacting event. - IncidentProperties *ServiceImpactingEventIncidentProperties `json:"incidentProperties,omitempty"` + IncidentProperties *ServiceImpactingEventIncidentProperties // Status of the service impacting event. - Status *ServiceImpactingEventStatus `json:"status,omitempty"` + Status *ServiceImpactingEventStatus } // ServiceImpactingEventIncidentProperties - Properties of the service impacting event. type ServiceImpactingEventIncidentProperties struct { // Type of Event. - IncidentType *string `json:"incidentType,omitempty"` + IncidentType *string // Region impacted by the event. - Region *string `json:"region,omitempty"` + Region *string // Service impacted by the event. - Service *string `json:"service,omitempty"` + Service *string // Title of the incident. - Title *string `json:"title,omitempty"` + Title *string } // ServiceImpactingEventStatus - Status of the service impacting event. type ServiceImpactingEventStatus struct { // Current status of the event - Value *string `json:"value,omitempty"` + Value *string +} + +// StatusActiveEvent - Active event type of emerging issue. +type StatusActiveEvent struct { + // The cloud type of this active event. + Cloud *string + + // The details of active event. + Description *string + + // The list of emerging issues impacts. + Impacts []*EmergingIssueImpact + + // The last time modified on this banner. + LastModifiedTime *time.Time + + // The boolean value of this active event if published or not. + Published *bool + + // The severity level of this active event. + Severity *SeverityValues + + // The stage of this active event. + Stage *StageValues + + // The impact start time on this active event. + StartTime *time.Time + + // The active event title. + Title *string + + // The tracking id of this active event. + TrackingID *string } // StatusBanner - Banner type of emerging issue. type StatusBanner struct { // The cloud type of this banner. - Cloud *string `json:"cloud,omitempty"` + Cloud *string // The last time modified on this banner. - LastModifiedTime *time.Time `json:"lastModifiedTime,omitempty"` + LastModifiedTime *time.Time // The details of banner. - Message *string `json:"message,omitempty"` + Message *string // The banner title. - Title *string `json:"title,omitempty"` + Title *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// Update for service health event. +type Update struct { + // Summary text for the given update for the service health event. + Summary *string + + // It provides the Timestamp for the given update for the service health event. + UpdateDateTime *time.Time } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/models_serde.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/models_serde.go index d87f6577a963..71c0c955082b 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/models_serde.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/models_serde.go @@ -93,13 +93,16 @@ func (a *AvailabilityStatusListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AvailabilityStatusProperties. func (a AvailabilityStatusProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "articleId", a.ArticleID) populate(objectMap, "availabilityState", a.AvailabilityState) + populate(objectMap, "category", a.Category) + populate(objectMap, "context", a.Context) populate(objectMap, "detailedStatus", a.DetailedStatus) populate(objectMap, "healthEventCategory", a.HealthEventCategory) populate(objectMap, "healthEventCause", a.HealthEventCause) populate(objectMap, "healthEventId", a.HealthEventID) populate(objectMap, "healthEventType", a.HealthEventType) - populateTimeRFC3339(objectMap, "occurredTime", a.OccurredTime) + populateTimeRFC3339(objectMap, "occuredTime", a.OccurredTime) populate(objectMap, "reasonChronicity", a.ReasonChronicity) populate(objectMap, "reasonType", a.ReasonType) populate(objectMap, "recentlyResolved", a.RecentlyResolved) @@ -122,9 +125,18 @@ func (a *AvailabilityStatusProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "articleId": + err = unpopulate(val, "ArticleID", &a.ArticleID) + delete(rawMsg, key) case "availabilityState": err = unpopulate(val, "AvailabilityState", &a.AvailabilityState) delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "context": + err = unpopulate(val, "Context", &a.Context) + delete(rawMsg, key) case "detailedStatus": err = unpopulate(val, "DetailedStatus", &a.DetailedStatus) delete(rawMsg, key) @@ -140,7 +152,7 @@ func (a *AvailabilityStatusProperties) UnmarshalJSON(data []byte) error { case "healthEventType": err = unpopulate(val, "HealthEventType", &a.HealthEventType) delete(rawMsg, key) - case "occurredTime": + case "occuredTime": err = unpopulateTimeRFC3339(val, "OccurredTime", &a.OccurredTime) delete(rawMsg, key) case "reasonChronicity": @@ -164,228 +176,1044 @@ func (a *AvailabilityStatusProperties) UnmarshalJSON(data []byte) error { case "rootCauseAttributionTime": err = unpopulateTimeRFC3339(val, "RootCauseAttributionTime", &a.RootCauseAttributionTime) delete(rawMsg, key) - case "serviceImpactingEvents": - err = unpopulate(val, "ServiceImpactingEvents", &a.ServiceImpactingEvents) + case "serviceImpactingEvents": + err = unpopulate(val, "ServiceImpactingEvents", &a.ServiceImpactingEvents) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &a.Summary) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &a.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilityStatusPropertiesRecentlyResolved. +func (a AvailabilityStatusPropertiesRecentlyResolved) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "resolvedTime", a.ResolvedTime) + populate(objectMap, "unavailableSummary", a.UnavailabilitySummary) + populateTimeRFC3339(objectMap, "unavailableOccuredTime", a.UnavailableOccurredTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityStatusPropertiesRecentlyResolved. +func (a *AvailabilityStatusPropertiesRecentlyResolved) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resolvedTime": + err = unpopulateTimeRFC3339(val, "ResolvedTime", &a.ResolvedTime) + delete(rawMsg, key) + case "unavailableSummary": + err = unpopulate(val, "UnavailabilitySummary", &a.UnavailabilitySummary) + delete(rawMsg, key) + case "unavailableOccuredTime": + err = unpopulateTimeRFC3339(val, "UnavailableOccurredTime", &a.UnavailableOccurredTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmergingIssue. +func (e EmergingIssue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "refreshTimestamp", e.RefreshTimestamp) + populate(objectMap, "statusActiveEvents", e.StatusActiveEvents) + populate(objectMap, "statusBanners", e.StatusBanners) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmergingIssue. +func (e *EmergingIssue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "refreshTimestamp": + err = unpopulateTimeRFC3339(val, "RefreshTimestamp", &e.RefreshTimestamp) + delete(rawMsg, key) + case "statusActiveEvents": + err = unpopulate(val, "StatusActiveEvents", &e.StatusActiveEvents) + delete(rawMsg, key) + case "statusBanners": + err = unpopulate(val, "StatusBanners", &e.StatusBanners) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmergingIssueImpact. +func (e EmergingIssueImpact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "regions", e.Regions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmergingIssueImpact. +func (e *EmergingIssueImpact) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "regions": + err = unpopulate(val, "Regions", &e.Regions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmergingIssueListResult. +func (e EmergingIssueListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmergingIssueListResult. +func (e *EmergingIssueListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmergingIssuesGetResult. +func (e EmergingIssuesGetResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmergingIssuesGetResult. +func (e *EmergingIssuesGetResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Event. +func (e Event) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Event. +func (e *Event) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventImpactedResource. +func (e EventImpactedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventImpactedResource. +func (e *EventImpactedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventImpactedResourceListResult. +func (e EventImpactedResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventImpactedResourceListResult. +func (e *EventImpactedResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventImpactedResourceProperties. +func (e EventImpactedResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", e.Info) + populate(objectMap, "targetRegion", e.TargetRegion) + populate(objectMap, "targetResourceId", e.TargetResourceID) + populate(objectMap, "targetResourceType", e.TargetResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventImpactedResourceProperties. +func (e *EventImpactedResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "targetRegion": + err = unpopulate(val, "TargetRegion", &e.TargetRegion) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &e.TargetResourceID) + delete(rawMsg, key) + case "targetResourceType": + err = unpopulate(val, "TargetResourceType", &e.TargetResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventProperties. +func (e EventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInformation", e.AdditionalInformation) + populate(objectMap, "article", e.Article) + populate(objectMap, "description", e.Description) + populate(objectMap, "duration", e.Duration) + populate(objectMap, "enableChatWithUs", e.EnableChatWithUs) + populate(objectMap, "enableMicrosoftSupport", e.EnableMicrosoftSupport) + populate(objectMap, "eventLevel", e.EventLevel) + populate(objectMap, "eventSource", e.EventSource) + populate(objectMap, "eventType", e.EventType) + populate(objectMap, "externalIncidentId", e.ExternalIncidentID) + populate(objectMap, "faqs", e.Faqs) + populate(objectMap, "header", e.Header) + populate(objectMap, "hirStage", e.HirStage) + populate(objectMap, "impact", e.Impact) + populateTimeRFC3339(objectMap, "impactMitigationTime", e.ImpactMitigationTime) + populateTimeRFC3339(objectMap, "impactStartTime", e.ImpactStartTime) + populate(objectMap, "impactType", e.ImpactType) + populate(objectMap, "isHIR", e.IsHIR) + populateTimeRFC3339(objectMap, "lastUpdateTime", e.LastUpdateTime) + populate(objectMap, "level", e.Level) + populate(objectMap, "links", e.Links) + populate(objectMap, "platformInitiated", e.PlatformInitiated) + populate(objectMap, "priority", e.Priority) + populate(objectMap, "reason", e.Reason) + populate(objectMap, "recommendedActions", e.RecommendedActions) + populate(objectMap, "status", e.Status) + populate(objectMap, "summary", e.Summary) + populate(objectMap, "title", e.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventProperties. +func (e *EventProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInformation": + err = unpopulate(val, "AdditionalInformation", &e.AdditionalInformation) + delete(rawMsg, key) + case "article": + err = unpopulate(val, "Article", &e.Article) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "duration": + err = unpopulate(val, "Duration", &e.Duration) + delete(rawMsg, key) + case "enableChatWithUs": + err = unpopulate(val, "EnableChatWithUs", &e.EnableChatWithUs) + delete(rawMsg, key) + case "enableMicrosoftSupport": + err = unpopulate(val, "EnableMicrosoftSupport", &e.EnableMicrosoftSupport) + delete(rawMsg, key) + case "eventLevel": + err = unpopulate(val, "EventLevel", &e.EventLevel) + delete(rawMsg, key) + case "eventSource": + err = unpopulate(val, "EventSource", &e.EventSource) + delete(rawMsg, key) + case "eventType": + err = unpopulate(val, "EventType", &e.EventType) + delete(rawMsg, key) + case "externalIncidentId": + err = unpopulate(val, "ExternalIncidentID", &e.ExternalIncidentID) + delete(rawMsg, key) + case "faqs": + err = unpopulate(val, "Faqs", &e.Faqs) + delete(rawMsg, key) + case "header": + err = unpopulate(val, "Header", &e.Header) + delete(rawMsg, key) + case "hirStage": + err = unpopulate(val, "HirStage", &e.HirStage) + delete(rawMsg, key) + case "impact": + err = unpopulate(val, "Impact", &e.Impact) + delete(rawMsg, key) + case "impactMitigationTime": + err = unpopulateTimeRFC3339(val, "ImpactMitigationTime", &e.ImpactMitigationTime) + delete(rawMsg, key) + case "impactStartTime": + err = unpopulateTimeRFC3339(val, "ImpactStartTime", &e.ImpactStartTime) + delete(rawMsg, key) + case "impactType": + err = unpopulate(val, "ImpactType", &e.ImpactType) + delete(rawMsg, key) + case "isHIR": + err = unpopulate(val, "IsHIR", &e.IsHIR) + delete(rawMsg, key) + case "lastUpdateTime": + err = unpopulateTimeRFC3339(val, "LastUpdateTime", &e.LastUpdateTime) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &e.Level) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &e.Links) + delete(rawMsg, key) + case "platformInitiated": + err = unpopulate(val, "PlatformInitiated", &e.PlatformInitiated) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &e.Priority) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &e.Reason) + delete(rawMsg, key) + case "recommendedActions": + err = unpopulate(val, "RecommendedActions", &e.RecommendedActions) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &e.Summary) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &e.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventPropertiesAdditionalInformation. +func (e EventPropertiesAdditionalInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventPropertiesAdditionalInformation. +func (e *EventPropertiesAdditionalInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventPropertiesArticle. +func (e EventPropertiesArticle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "articleContent", e.ArticleContent) + populate(objectMap, "articleId", e.ArticleID) + populateAny(objectMap, "parameters", e.Parameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventPropertiesArticle. +func (e *EventPropertiesArticle) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "articleContent": + err = unpopulate(val, "ArticleContent", &e.ArticleContent) + delete(rawMsg, key) + case "articleId": + err = unpopulate(val, "ArticleID", &e.ArticleID) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &e.Parameters) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventPropertiesRecommendedActions. +func (e EventPropertiesRecommendedActions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", e.Actions) + populate(objectMap, "localeCode", e.LocaleCode) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventPropertiesRecommendedActions. +func (e *EventPropertiesRecommendedActions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &e.Actions) + delete(rawMsg, key) + case "localeCode": + err = unpopulate(val, "LocaleCode", &e.LocaleCode) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventPropertiesRecommendedActionsItem. +func (e EventPropertiesRecommendedActionsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionText", e.ActionText) + populate(objectMap, "groupId", e.GroupID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventPropertiesRecommendedActionsItem. +func (e *EventPropertiesRecommendedActionsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionText": + err = unpopulate(val, "ActionText", &e.ActionText) + delete(rawMsg, key) + case "groupId": + err = unpopulate(val, "GroupID", &e.GroupID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Events. +func (e Events) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Events. +func (e *Events) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Faq. +func (f Faq) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "answer", f.Answer) + populate(objectMap, "localeCode", f.LocaleCode) + populate(objectMap, "question", f.Question) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Faq. +func (f *Faq) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "answer": + err = unpopulate(val, "Answer", &f.Answer) + delete(rawMsg, key) + case "localeCode": + err = unpopulate(val, "LocaleCode", &f.LocaleCode) + delete(rawMsg, key) + case "question": + err = unpopulate(val, "Question", &f.Question) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Impact. +func (i Impact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "impactedRegions", i.ImpactedRegions) + populate(objectMap, "impactedService", i.ImpactedService) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Impact. +func (i *Impact) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "impactedRegions": + err = unpopulate(val, "ImpactedRegions", &i.ImpactedRegions) + delete(rawMsg, key) + case "impactedService": + err = unpopulate(val, "ImpactedService", &i.ImpactedService) delete(rawMsg, key) - case "summary": - err = unpopulate(val, "Summary", &a.Summary) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImpactedRegion. +func (i ImpactedRegion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImpactedRegion. +func (i *ImpactedRegion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &a.Title) + case "name": + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AvailabilityStatusPropertiesRecentlyResolved. -func (a AvailabilityStatusPropertiesRecentlyResolved) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImpactedServiceRegion. +func (i ImpactedServiceRegion) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "resolvedTime", a.ResolvedTime) - populate(objectMap, "unavailabilitySummary", a.UnavailabilitySummary) - populateTimeRFC3339(objectMap, "unavailableOccurredTime", a.UnavailableOccurredTime) + populate(objectMap, "impactedRegion", i.ImpactedRegion) + populate(objectMap, "impactedSubscriptions", i.ImpactedSubscriptions) + populate(objectMap, "impactedTenants", i.ImpactedTenants) + populateTimeRFC3339(objectMap, "lastUpdateTime", i.LastUpdateTime) + populate(objectMap, "status", i.Status) + populate(objectMap, "updates", i.Updates) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityStatusPropertiesRecentlyResolved. -func (a *AvailabilityStatusPropertiesRecentlyResolved) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImpactedServiceRegion. +func (i *ImpactedServiceRegion) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "resolvedTime": - err = unpopulateTimeRFC3339(val, "ResolvedTime", &a.ResolvedTime) + case "impactedRegion": + err = unpopulate(val, "ImpactedRegion", &i.ImpactedRegion) delete(rawMsg, key) - case "unavailabilitySummary": - err = unpopulate(val, "UnavailabilitySummary", &a.UnavailabilitySummary) + case "impactedSubscriptions": + err = unpopulate(val, "ImpactedSubscriptions", &i.ImpactedSubscriptions) delete(rawMsg, key) - case "unavailableOccurredTime": - err = unpopulateTimeRFC3339(val, "UnavailableOccurredTime", &a.UnavailableOccurredTime) + case "impactedTenants": + err = unpopulate(val, "ImpactedTenants", &i.ImpactedTenants) + delete(rawMsg, key) + case "lastUpdateTime": + err = unpopulateTimeRFC3339(val, "LastUpdateTime", &i.LastUpdateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + case "updates": + err = unpopulate(val, "Updates", &i.Updates) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KeyValueItem. +func (k KeyValueItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "key", k.Key) + populate(objectMap, "value", k.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyValueItem. +func (k *KeyValueItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "key": + err = unpopulate(val, "Key", &k.Key) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &k.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseError. -func (e ErrorResponseError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Link. +func (l Link) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) + populate(objectMap, "bladeName", l.BladeName) + populate(objectMap, "displayText", l.DisplayText) + populate(objectMap, "extensionName", l.ExtensionName) + populateAny(objectMap, "parameters", l.Parameters) + populate(objectMap, "type", l.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseError. -func (e *ErrorResponseError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Link. +func (l *Link) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "bladeName": + err = unpopulate(val, "BladeName", &l.BladeName) delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) + case "displayText": + err = unpopulate(val, "DisplayText", &l.DisplayText) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "extensionName": + err = unpopulate(val, "ExtensionName", &l.ExtensionName) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &l.Parameters) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImpactedRegion. -func (i ImpactedRegion) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LinkDisplayText. +func (l LinkDisplayText) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) + populate(objectMap, "localizedValue", l.LocalizedValue) + populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImpactedRegion. -func (i *ImpactedRegion) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkDisplayText. +func (l *LinkDisplayText) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &l.LocalizedValue) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) + case "value": + err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImpactedResourceStatus. -func (i ImpactedResourceStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataEntity. +func (m MetadataEntity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImpactedResourceStatus. -func (i *ImpactedResourceStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataEntity. +func (m *MetadataEntity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &i.ID) + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &i.Name) + err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &i.Properties) + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &i.Type) + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImpactedResourceStatusProperties. -func (i ImpactedResourceStatusProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataEntityListResult. +func (m MetadataEntityListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "availabilityState", i.AvailabilityState) - populateTimeRFC3339(objectMap, "occurredTime", i.OccurredTime) - populate(objectMap, "reasonType", i.ReasonType) - populate(objectMap, "summary", i.Summary) - populate(objectMap, "title", i.Title) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImpactedResourceStatusProperties. -func (i *ImpactedResourceStatusProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataEntityListResult. +func (m *MetadataEntityListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "availabilityState": - err = unpopulate(val, "AvailabilityState", &i.AvailabilityState) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "occurredTime": - err = unpopulateTimeRFC3339(val, "OccurredTime", &i.OccurredTime) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) - case "reasonType": - err = unpopulate(val, "ReasonType", &i.ReasonType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataEntityProperties. +func (m MetadataEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicableScenarios", m.ApplicableScenarios) + populate(objectMap, "dependsOn", m.DependsOn) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "supportedValues", m.SupportedValues) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataEntityProperties. +func (m *MetadataEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicableScenarios": + err = unpopulate(val, "ApplicableScenarios", &m.ApplicableScenarios) delete(rawMsg, key) - case "summary": - err = unpopulate(val, "Summary", &i.Summary) + case "dependsOn": + err = unpopulate(val, "DependsOn", &m.DependsOn) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &i.Title) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "supportedValues": + err = unpopulate(val, "SupportedValues", &m.SupportedValues) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataSupportedValueDetail. +func (m MetadataSupportedValueDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "id", m.ID) + populate(objectMap, "resourceTypes", m.ResourceTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataSupportedValueDetail. +func (m *MetadataSupportedValueDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "resourceTypes": + err = unpopulate(val, "ResourceTypes", &m.ResourceTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil @@ -493,6 +1321,7 @@ func (r RecommendedAction) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "action", r.Action) populate(objectMap, "actionUrl", r.ActionURL) + populate(objectMap, "_ActionUrl.Comment", r.ActionURLComment) populate(objectMap, "actionUrlText", r.ActionURLText) return json.Marshal(objectMap) } @@ -512,6 +1341,9 @@ func (r *RecommendedAction) UnmarshalJSON(data []byte) error { case "actionUrl": err = unpopulate(val, "ActionURL", &r.ActionURL) delete(rawMsg, key) + case "_ActionUrl.Comment": + err = unpopulate(val, "ActionURLComment", &r.ActionURLComment) + delete(rawMsg, key) case "actionUrlText": err = unpopulate(val, "ActionURLText", &r.ActionURLText) delete(rawMsg, key) @@ -523,41 +1355,6 @@ func (r *RecommendedAction) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ServiceImpactingEvent. func (s ServiceImpactingEvent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -667,6 +1464,69 @@ func (s *ServiceImpactingEventStatus) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type StatusActiveEvent. +func (s StatusActiveEvent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cloud", s.Cloud) + populate(objectMap, "description", s.Description) + populate(objectMap, "impacts", s.Impacts) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) + populate(objectMap, "published", s.Published) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "stage", s.Stage) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) + populate(objectMap, "title", s.Title) + populate(objectMap, "trackingId", s.TrackingID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StatusActiveEvent. +func (s *StatusActiveEvent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cloud": + err = unpopulate(val, "Cloud", &s.Cloud) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "impacts": + err = unpopulate(val, "Impacts", &s.Impacts) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateTimeRFC3339(val, "LastModifiedTime", &s.LastModifiedTime) + delete(rawMsg, key) + case "published": + err = unpopulate(val, "Published", &s.Published) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "stage": + err = unpopulate(val, "Stage", &s.Stage) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &s.Title) + delete(rawMsg, key) + case "trackingId": + err = unpopulate(val, "TrackingID", &s.TrackingID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type StatusBanner. func (s StatusBanner) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -706,6 +1566,84 @@ func (s *StatusBanner) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Update. +func (u Update) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "summary", u.Summary) + populateTimeRFC3339(objectMap, "updateDateTime", u.UpdateDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Update. +func (u *Update) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "summary": + err = unpopulate(val, "Summary", &u.Summary) + delete(rawMsg, key) + case "updateDateTime": + err = unpopulateTimeRFC3339(val, "UpdateDateTime", &u.UpdateDateTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return @@ -716,6 +1654,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client.go index b991cedfd195..8c28b80c30fe 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client.go @@ -41,7 +41,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // List - Lists available operations for the resourcehealth resource provider // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-05-01 +// Generated from API version 2022-10-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { req, err := client.listCreateRequest(ctx, options) @@ -66,7 +66,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client_example_test.go index d493e7c06033..3c36e87b6204 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client_example_test.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Operations_List.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/response_types.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/response_types.go index d4faab81e730..24766440666a 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/response_types.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/response_types.go @@ -29,7 +29,107 @@ type AvailabilityStatusesClientListResponse struct { AvailabilityStatusListResult } +// ChildAvailabilityStatusesClientGetByResourceResponse contains the response from method ChildAvailabilityStatusesClient.GetByResource. +type ChildAvailabilityStatusesClientGetByResourceResponse struct { + AvailabilityStatus +} + +// ChildAvailabilityStatusesClientListResponse contains the response from method ChildAvailabilityStatusesClient.NewListPager. +type ChildAvailabilityStatusesClientListResponse struct { + AvailabilityStatusListResult +} + +// ChildResourcesClientListResponse contains the response from method ChildResourcesClient.NewListPager. +type ChildResourcesClientListResponse struct { + AvailabilityStatusListResult +} + +// EmergingIssuesClientGetResponse contains the response from method EmergingIssuesClient.Get. +type EmergingIssuesClientGetResponse struct { + EmergingIssuesGetResult +} + +// EmergingIssuesClientListResponse contains the response from method EmergingIssuesClient.NewListPager. +type EmergingIssuesClientListResponse struct { + EmergingIssueListResult +} + +// EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse contains the response from method EventClient.FetchDetailsBySubscriptionIDAndTrackingID. +type EventClientFetchDetailsBySubscriptionIDAndTrackingIDResponse struct { + Event +} + +// EventClientFetchDetailsByTenantIDAndTrackingIDResponse contains the response from method EventClient.FetchDetailsByTenantIDAndTrackingID. +type EventClientFetchDetailsByTenantIDAndTrackingIDResponse struct { + Event +} + +// EventClientGetBySubscriptionIDAndTrackingIDResponse contains the response from method EventClient.GetBySubscriptionIDAndTrackingID. +type EventClientGetBySubscriptionIDAndTrackingIDResponse struct { + Event +} + +// EventClientGetByTenantIDAndTrackingIDResponse contains the response from method EventClient.GetByTenantIDAndTrackingID. +type EventClientGetByTenantIDAndTrackingIDResponse struct { + Event +} + +// EventsClientListBySingleResourceResponse contains the response from method EventsClient.NewListBySingleResourcePager. +type EventsClientListBySingleResourceResponse struct { + Events +} + +// EventsClientListBySubscriptionIDResponse contains the response from method EventsClient.NewListBySubscriptionIDPager. +type EventsClientListBySubscriptionIDResponse struct { + Events +} + +// EventsClientListByTenantIDResponse contains the response from method EventsClient.NewListByTenantIDPager. +type EventsClientListByTenantIDResponse struct { + Events +} + +// ImpactedResourcesClientGetByTenantIDResponse contains the response from method ImpactedResourcesClient.GetByTenantID. +type ImpactedResourcesClientGetByTenantIDResponse struct { + EventImpactedResource +} + +// ImpactedResourcesClientGetResponse contains the response from method ImpactedResourcesClient.Get. +type ImpactedResourcesClientGetResponse struct { + EventImpactedResource +} + +// ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse contains the response from method ImpactedResourcesClient.NewListBySubscriptionIDAndEventIDPager. +type ImpactedResourcesClientListBySubscriptionIDAndEventIDResponse struct { + EventImpactedResourceListResult +} + +// ImpactedResourcesClientListByTenantIDAndEventIDResponse contains the response from method ImpactedResourcesClient.NewListByTenantIDAndEventIDPager. +type ImpactedResourcesClientListByTenantIDAndEventIDResponse struct { + EventImpactedResourceListResult +} + +// MetadataClientGetEntityResponse contains the response from method MetadataClient.GetEntity. +type MetadataClientGetEntityResponse struct { + MetadataEntity +} + +// MetadataClientListResponse contains the response from method MetadataClient.NewListPager. +type MetadataClientListResponse struct { + MetadataEntityListResult +} + // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { OperationListResult } + +// SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse contains the response from method SecurityAdvisoryImpactedResourcesClient.NewListBySubscriptionIDAndEventIDPager. +type SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse struct { + EventImpactedResourceListResult +} + +// SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse contains the response from method SecurityAdvisoryImpactedResourcesClient.NewListByTenantIDAndEventIDPager. +type SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse struct { + EventImpactedResourceListResult +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/securityadvisoryimpactedresources_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/securityadvisoryimpactedresources_client.go new file mode 100644 index 000000000000..701e81b2fb69 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/securityadvisoryimpactedresources_client.go @@ -0,0 +1,177 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SecurityAdvisoryImpactedResourcesClient contains the methods for the SecurityAdvisoryImpactedResources group. +// Don't use this type directly, use NewSecurityAdvisoryImpactedResourcesClient() instead. +type SecurityAdvisoryImpactedResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSecurityAdvisoryImpactedResourcesClient creates a new instance of SecurityAdvisoryImpactedResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSecurityAdvisoryImpactedResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecurityAdvisoryImpactedResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".SecurityAdvisoryImpactedResourcesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecurityAdvisoryImpactedResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListBySubscriptionIDAndEventIDPager - Lists impacted resources in the subscription by an event (Security Advisory). +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - options - SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDOptions contains the optional parameters +// for the SecurityAdvisoryImpactedResourcesClient.NewListBySubscriptionIDAndEventIDPager method. +func (client *SecurityAdvisoryImpactedResourcesClient) NewListBySubscriptionIDAndEventIDPager(eventTrackingID string, options *SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDOptions) *runtime.Pager[SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse]{ + More: func(page SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse) (SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionIDAndEventIDCreateRequest(ctx, eventTrackingID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionIDAndEventIDHandleResponse(resp) + }, + }) +} + +// listBySubscriptionIDAndEventIDCreateRequest creates the ListBySubscriptionIDAndEventID request. +func (client *SecurityAdvisoryImpactedResourcesClient) listBySubscriptionIDAndEventIDCreateRequest(ctx context.Context, eventTrackingID string, options *SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionIDAndEventIDHandleResponse handles the ListBySubscriptionIDAndEventID response. +func (client *SecurityAdvisoryImpactedResourcesClient) listBySubscriptionIDAndEventIDHandleResponse(resp *http.Response) (SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse, error) { + result := SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventImpactedResourceListResult); err != nil { + return SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDResponse{}, err + } + return result, nil +} + +// NewListByTenantIDAndEventIDPager - Lists impacted resources in the tenant by an event (Security Advisory). +// +// Generated from API version 2022-10-01 +// - eventTrackingID - Event Id which uniquely identifies ServiceHealth event. +// - options - SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDOptions contains the optional parameters for the +// SecurityAdvisoryImpactedResourcesClient.NewListByTenantIDAndEventIDPager method. +func (client *SecurityAdvisoryImpactedResourcesClient) NewListByTenantIDAndEventIDPager(eventTrackingID string, options *SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDOptions) *runtime.Pager[SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse]{ + More: func(page SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse) (SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByTenantIDAndEventIDCreateRequest(ctx, eventTrackingID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse{}, runtime.NewResponseError(resp) + } + return client.listByTenantIDAndEventIDHandleResponse(resp) + }, + }) +} + +// listByTenantIDAndEventIDCreateRequest creates the ListByTenantIDAndEventID request. +func (client *SecurityAdvisoryImpactedResourcesClient) listByTenantIDAndEventIDCreateRequest(ctx context.Context, eventTrackingID string, options *SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" + if eventTrackingID == "" { + return nil, errors.New("parameter eventTrackingID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventTrackingId}", url.PathEscape(eventTrackingID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTenantIDAndEventIDHandleResponse handles the ListByTenantIDAndEventID response. +func (client *SecurityAdvisoryImpactedResourcesClient) listByTenantIDAndEventIDHandleResponse(resp *http.Response) (SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse, error) { + result := SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventImpactedResourceListResult); err != nil { + return SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/securityadvisoryimpactedresources_client_example_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/securityadvisoryimpactedresources_client_example_test.go new file mode 100644 index 000000000000..7388e883e6b3 --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/securityadvisoryimpactedresources_client_example_test.go @@ -0,0 +1,170 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armresourcehealth_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json +func ExampleSecurityAdvisoryImpactedResourcesClient_NewListBySubscriptionIDAndEventIDPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSecurityAdvisoryImpactedResourcesClient().NewListBySubscriptionIDAndEventIDPager("BC_1-FXZ", &armresourcehealth.SecurityAdvisoryImpactedResourcesClientListBySubscriptionIDAndEventIDOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.EventImpactedResourceListResult = armresourcehealth.EventImpactedResourceListResult{ + // Value: []*armresourcehealth.EventImpactedResource{ + // { + // Name: to.Ptr("jkl-901-hgy-445"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/subscriptions/{subscripitionId}/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/jkl-901-hgy-445"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // Info: []*armresourcehealth.KeyValueItem{ + // { + // Key: to.Ptr("key-A"), + // Value: to.Ptr("sample-1"), + // }, + // { + // Key: to.Ptr("key-B"), + // Value: to.Ptr("sample-2"), + // }, + // { + // Key: to.Ptr("key-C"), + // Value: to.Ptr("sample-3"), + // }, + // { + // Key: to.Ptr("key-D"), + // Value: to.Ptr("sample-4"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("wer-345-tyu-789"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/subscriptions/{subscripitionId}/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/wer-345-tyu-789"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // Info: []*armresourcehealth.KeyValueItem{ + // { + // Key: to.Ptr("key-E"), + // Value: to.Ptr("sample-5"), + // }, + // { + // Key: to.Ptr("key-F"), + // Value: to.Ptr("sample-6"), + // }, + // { + // Key: to.Ptr("key-G"), + // Value: to.Ptr("sample-7"), + // }, + // { + // Key: to.Ptr("key-H"), + // Value: to.Ptr("sample-8"), + // }}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json +func ExampleSecurityAdvisoryImpactedResourcesClient_NewListByTenantIDAndEventIDPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSecurityAdvisoryImpactedResourcesClient().NewListByTenantIDAndEventIDPager("BC_1-FXZ", &armresourcehealth.SecurityAdvisoryImpactedResourcesClientListByTenantIDAndEventIDOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.EventImpactedResourceListResult = armresourcehealth.EventImpactedResourceListResult{ + // Value: []*armresourcehealth.EventImpactedResource{ + // { + // Name: to.Ptr("jkl-901-hgy-445"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/jkl-901-hgy-445"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // Info: []*armresourcehealth.KeyValueItem{ + // { + // Key: to.Ptr("key-A"), + // Value: to.Ptr("sample-1"), + // }, + // { + // Key: to.Ptr("key-B"), + // Value: to.Ptr("sample-2"), + // }, + // { + // Key: to.Ptr("key-C"), + // Value: to.Ptr("sample-3"), + // }, + // { + // Key: to.Ptr("key-D"), + // Value: to.Ptr("sample-4"), + // }}, + // }, + // }, + // { + // Name: to.Ptr("wer-345-tyu-789"), + // Type: to.Ptr("Microsoft.ResourceHealth/events/impactedResources"), + // ID: to.Ptr("/providers/Microsoft.ResourceHealth/events/BC_1-FXZ/impactedResources/wer-345-tyu-789"), + // Properties: &armresourcehealth.EventImpactedResourceProperties{ + // Info: []*armresourcehealth.KeyValueItem{ + // { + // Key: to.Ptr("key-E"), + // Value: to.Ptr("sample-5"), + // }, + // { + // Key: to.Ptr("key-F"), + // Value: to.Ptr("sample-6"), + // }, + // { + // Key: to.Ptr("key-G"), + // Value: to.Ptr("sample-7"), + // }, + // { + // Key: to.Ptr("key-H"), + // Value: to.Ptr("sample-8"), + // }}, + // }, + // }}, + // } + } +}