diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md b/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md index 570333ada84b..899df5c174c5 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md @@ -1,5 +1,24 @@ # Release History +## 2.0.0 (2022-09-15) +### Breaking Changes + +- Struct `ErrorResponseError` has been removed +- Field `UnavailabilitySummary` of struct `AvailabilityStatusPropertiesRecentlyResolved` has been removed +- Field `UnavailableOccurredTime` of struct `AvailabilityStatusPropertiesRecentlyResolved` has been removed +- Field `Error` of struct `ErrorResponse` has been removed +- Field `OccurredTime` of struct `AvailabilityStatusProperties` has been removed + +### Features Added + +- New field `Code` in struct `ErrorResponse` +- New field `Details` in struct `ErrorResponse` +- New field `Message` in struct `ErrorResponse` +- New field `OccuredTime` in struct `AvailabilityStatusProperties` +- New field `UnavailableOccuredTime` in struct `AvailabilityStatusPropertiesRecentlyResolved` +- New field `UnavailableSummary` in struct `AvailabilityStatusPropertiesRecentlyResolved` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md b/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md index a8f55772a85d..d9103f7cb933 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md @@ -5,8 +5,8 @@ ``` 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 +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resourcehealth/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resourcehealth/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_availabilitystatuses_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client.go similarity index 98% rename from sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_availabilitystatuses_client.go rename to sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client.go index c47731e5702b..ebf0522524c8 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_availabilitystatuses_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/availabilitystatuses_client.go @@ -5,6 +5,7 @@ // 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 @@ -111,7 +112,6 @@ func (client *AvailabilityStatusesClient) getByResourceHandleResponse(resp *http } // NewListPager - Lists all historical availability transitions and impacting events for a single resource. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-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 : @@ -179,7 +179,6 @@ func (client *AvailabilityStatusesClient) listHandleResponse(resp *http.Response } // NewListByResourceGroupPager - Lists the current availability status for all the resources in the resource group. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // resourceGroupName - The name of the resource group. // options - AvailabilityStatusesClientListByResourceGroupOptions contains the optional parameters for the AvailabilityStatusesClient.ListByResourceGroup @@ -250,7 +249,6 @@ func (client *AvailabilityStatusesClient) listByResourceGroupHandleResponse(resp } // NewListBySubscriptionIDPager - Lists the current availability status for all the resources in the subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // options - AvailabilityStatusesClientListBySubscriptionIDOptions contains the optional parameters for the AvailabilityStatusesClient.ListBySubscriptionID // method. diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_constants.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/constants.go similarity index 98% rename from sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_constants.go rename to sdk/resourcemanager/resourcehealth/armresourcehealth/constants.go index 840fb1a1656c..386c6f56fd8e 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_constants.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/constants.go @@ -5,12 +5,13 @@ // 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 const ( moduleName = "armresourcehealth" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // AvailabilityStateValues - Impacted resource status of the resource. diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod index 46c7a9f8484b..5900b76aa31e 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/models.go similarity index 97% rename from sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models.go rename to sdk/resourcemanager/resourcehealth/armresourcehealth/models.go index fb6d2706168c..d45bbdd6f9ee 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/models.go @@ -5,6 +5,7 @@ // 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 @@ -62,7 +63,7 @@ type AvailabilityStatusProperties struct { HealthEventType *string `json:"healthEventType,omitempty"` // Timestamp for when last change in health status occurred. - OccurredTime *time.Time `json:"occurredTime,omitempty"` + OccuredTime *time.Time `json:"occuredTime,omitempty"` // Chronicity of the availability transition. ReasonChronicity *ReasonChronicityTypes `json:"reasonChronicity,omitempty"` @@ -104,11 +105,11 @@ type AvailabilityStatusPropertiesRecentlyResolved struct { // Timestamp when the availabilityState changes to Available. ResolvedTime *time.Time `json:"resolvedTime,omitempty"` - // Brief description of cause of the resource becoming unavailable. - UnavailabilitySummary *string `json:"unavailabilitySummary,omitempty"` - // Timestamp for when the availabilityState changed to Unavailable - UnavailableOccurredTime *time.Time `json:"unavailableOccurredTime,omitempty"` + UnavailableOccuredTime *time.Time `json:"unavailableOccuredTime,omitempty"` + + // Brief description of cause of the resource becoming unavailable. + UnavailableSummary *string `json:"unavailableSummary,omitempty"` } // AvailabilityStatusesClientGetByResourceOptions contains the optional parameters for the AvailabilityStatusesClient.GetByResource @@ -148,12 +149,6 @@ type AvailabilityStatusesClientListOptions struct { // ErrorResponse - Error details. type ErrorResponse struct { - // The error object. - Error *ErrorResponseError `json:"error,omitempty"` -} - -// ErrorResponseError - The error object. -type ErrorResponseError struct { // READ-ONLY; The error code. Code *string `json:"code,omitempty" azure:"ro"` diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/models_serde.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/models_serde.go new file mode 100644 index 000000000000..c4b343ef215e --- /dev/null +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/models_serde.go @@ -0,0 +1,700 @@ +//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 ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AvailabilityStatus. +func (a AvailabilityStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityStatus. +func (a *AvailabilityStatus) 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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 AvailabilityStatusListResult. +func (a AvailabilityStatusListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityStatusListResult. +func (a *AvailabilityStatusListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 AvailabilityStatusProperties. +func (a AvailabilityStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityState", a.AvailabilityState) + 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, "occuredTime", a.OccuredTime) + populate(objectMap, "reasonChronicity", a.ReasonChronicity) + populate(objectMap, "reasonType", a.ReasonType) + populate(objectMap, "recentlyResolved", a.RecentlyResolved) + populate(objectMap, "recommendedActions", a.RecommendedActions) + populateTimeRFC3339(objectMap, "reportedTime", a.ReportedTime) + populateTimeRFC3339(objectMap, "resolutionETA", a.ResolutionETA) + populateTimeRFC3339(objectMap, "rootCauseAttributionTime", a.RootCauseAttributionTime) + populate(objectMap, "serviceImpactingEvents", a.ServiceImpactingEvents) + populate(objectMap, "summary", a.Summary) + populate(objectMap, "title", a.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityStatusProperties. +func (a *AvailabilityStatusProperties) 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 "availabilityState": + err = unpopulate(val, "AvailabilityState", &a.AvailabilityState) + delete(rawMsg, key) + case "detailedStatus": + err = unpopulate(val, "DetailedStatus", &a.DetailedStatus) + delete(rawMsg, key) + case "healthEventCategory": + err = unpopulate(val, "HealthEventCategory", &a.HealthEventCategory) + delete(rawMsg, key) + case "healthEventCause": + err = unpopulate(val, "HealthEventCause", &a.HealthEventCause) + delete(rawMsg, key) + case "healthEventId": + err = unpopulate(val, "HealthEventID", &a.HealthEventID) + delete(rawMsg, key) + case "healthEventType": + err = unpopulate(val, "HealthEventType", &a.HealthEventType) + delete(rawMsg, key) + case "occuredTime": + err = unpopulateTimeRFC3339(val, "OccuredTime", &a.OccuredTime) + delete(rawMsg, key) + case "reasonChronicity": + err = unpopulate(val, "ReasonChronicity", &a.ReasonChronicity) + delete(rawMsg, key) + case "reasonType": + err = unpopulate(val, "ReasonType", &a.ReasonType) + delete(rawMsg, key) + case "recentlyResolved": + err = unpopulate(val, "RecentlyResolved", &a.RecentlyResolved) + delete(rawMsg, key) + case "recommendedActions": + err = unpopulate(val, "RecommendedActions", &a.RecommendedActions) + delete(rawMsg, key) + case "reportedTime": + err = unpopulateTimeRFC3339(val, "ReportedTime", &a.ReportedTime) + delete(rawMsg, key) + case "resolutionETA": + err = unpopulateTimeRFC3339(val, "ResolutionETA", &a.ResolutionETA) + delete(rawMsg, key) + case "rootCauseAttributionTime": + err = unpopulateTimeRFC3339(val, "RootCauseAttributionTime", &a.RootCauseAttributionTime) + delete(rawMsg, key) + 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]interface{}) + populateTimeRFC3339(objectMap, "resolvedTime", a.ResolvedTime) + populateTimeRFC3339(objectMap, "unavailableOccuredTime", a.UnavailableOccuredTime) + populate(objectMap, "unavailableSummary", a.UnavailableSummary) + 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 "unavailableOccuredTime": + err = unpopulateTimeRFC3339(val, "UnavailableOccuredTime", &a.UnavailableOccuredTime) + delete(rawMsg, key) + case "unavailableSummary": + err = unpopulate(val, "UnavailableSummary", &a.UnavailableSummary) + 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 ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) 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 "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + 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 ImpactedRegion. +func (i ImpactedRegion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImpactedResourceStatus. +func (i ImpactedResourceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImpactedResourceStatus. +func (i *ImpactedResourceStatus) 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 "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImpactedResourceStatusProperties. +func (i ImpactedResourceStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImpactedResourceStatusProperties. +func (i *ImpactedResourceStatusProperties) 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 "availabilityState": + err = unpopulate(val, "AvailabilityState", &i.AvailabilityState) + delete(rawMsg, key) + case "occurredTime": + err = unpopulateTimeRFC3339(val, "OccurredTime", &i.OccurredTime) + delete(rawMsg, key) + case "reasonType": + err = unpopulate(val, "ReasonType", &i.ReasonType) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &i.Summary) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &i.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedAction. +func (r RecommendedAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", r.Action) + populate(objectMap, "actionUrl", r.ActionURL) + populate(objectMap, "actionUrlText", r.ActionURLText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedAction. +func (r *RecommendedAction) 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 "action": + err = unpopulate(val, "Action", &r.Action) + delete(rawMsg, key) + case "actionUrl": + err = unpopulate(val, "ActionURL", &r.ActionURL) + delete(rawMsg, key) + case "actionUrlText": + err = unpopulate(val, "ActionURLText", &r.ActionURLText) + 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + populate(objectMap, "correlationId", s.CorrelationID) + populateTimeRFC3339(objectMap, "eventStartTime", s.EventStartTime) + populateTimeRFC3339(objectMap, "eventStatusLastModifiedTime", s.EventStatusLastModifiedTime) + populate(objectMap, "incidentProperties", s.IncidentProperties) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceImpactingEvent. +func (s *ServiceImpactingEvent) 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 "correlationId": + err = unpopulate(val, "CorrelationID", &s.CorrelationID) + delete(rawMsg, key) + case "eventStartTime": + err = unpopulateTimeRFC3339(val, "EventStartTime", &s.EventStartTime) + delete(rawMsg, key) + case "eventStatusLastModifiedTime": + err = unpopulateTimeRFC3339(val, "EventStatusLastModifiedTime", &s.EventStatusLastModifiedTime) + delete(rawMsg, key) + case "incidentProperties": + err = unpopulate(val, "IncidentProperties", &s.IncidentProperties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 ServiceImpactingEventIncidentProperties. +func (s ServiceImpactingEventIncidentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "incidentType", s.IncidentType) + populate(objectMap, "region", s.Region) + populate(objectMap, "service", s.Service) + populate(objectMap, "title", s.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceImpactingEventIncidentProperties. +func (s *ServiceImpactingEventIncidentProperties) 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 "incidentType": + err = unpopulate(val, "IncidentType", &s.IncidentType) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &s.Region) + delete(rawMsg, key) + case "service": + err = unpopulate(val, "Service", &s.Service) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &s.Title) + 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 ServiceImpactingEventStatus. +func (s ServiceImpactingEventStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceImpactingEventStatus. +func (s *ServiceImpactingEventStatus) 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 "value": + err = unpopulate(val, "Value", &s.Value) + 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]interface{}) + populate(objectMap, "cloud", s.Cloud) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) + populate(objectMap, "message", s.Message) + populate(objectMap, "title", s.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StatusBanner. +func (s *StatusBanner) 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 "lastModifiedTime": + err = unpopulateTimeRFC3339(val, "LastModifiedTime", &s.LastModifiedTime) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &s.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_operations_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client.go similarity index 99% rename from sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_operations_client.go rename to sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client.go index 0510bd4c2660..dccc9b34ddfc 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_operations_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/operations_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_response_types.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/response_types.go similarity index 98% rename from sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_response_types.go rename to sdk/resourcemanager/resourcehealth/armresourcehealth/response_types.go index cb0914110abb..747263d7e566 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_response_types.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/response_types.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_time_rfc3339.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/resourcehealth/armresourcehealth/time_rfc3339.go index f91b092d0d2d..b6cacc35aee6 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/ze_generated_example_availabilitystatuses_client_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/ze_generated_example_availabilitystatuses_client_test.go deleted file mode 100644 index a64a4fece520..000000000000 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/ze_generated_example_availabilitystatuses_client_test.go +++ /dev/null @@ -1,95 +0,0 @@ -//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. - -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/tree/main/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_ListByResourceGroup.json -func ExampleAvailabilityStatusesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armresourcehealth.NewAvailabilityStatusesClient("subscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("resourceGroupName", - &armresourcehealth.AvailabilityStatusesClientListByResourceGroupOptions{Filter: nil, - Expand: to.Ptr("recommendedactions"), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatus_GetByResource.json -func ExampleAvailabilityStatusesClient_GetByResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armresourcehealth.NewAvailabilityStatusesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByResource(ctx, - "resourceUri", - &armresourcehealth.AvailabilityStatusesClientGetByResourceOptions{Filter: nil, - Expand: to.Ptr("recommendedactions"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/AvailabilityStatuses_List.json -func ExampleAvailabilityStatusesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armresourcehealth.NewAvailabilityStatusesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("resourceUri", - &armresourcehealth.AvailabilityStatusesClientListOptions{Filter: nil, - Expand: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/ze_generated_example_operations_client_test.go deleted file mode 100644 index a61191d017b8..000000000000 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,37 +0,0 @@ -//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. - -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/tree/main/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2020-05-01/examples/Operations_List.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armresourcehealth.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models_serde.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models_serde.go deleted file mode 100644 index 5eabfd5e0aa4..000000000000 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models_serde.go +++ /dev/null @@ -1,211 +0,0 @@ -//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. - -package armresourcehealth - -import ( - "encoding/json" - "fmt" -) - -// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityStatusProperties. -func (a *AvailabilityStatusProperties) 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 "availabilityState": - err = unpopulate(val, "AvailabilityState", &a.AvailabilityState) - delete(rawMsg, key) - case "detailedStatus": - err = unpopulate(val, "DetailedStatus", &a.DetailedStatus) - delete(rawMsg, key) - case "healthEventCategory": - err = unpopulate(val, "HealthEventCategory", &a.HealthEventCategory) - delete(rawMsg, key) - case "healthEventCause": - err = unpopulate(val, "HealthEventCause", &a.HealthEventCause) - delete(rawMsg, key) - case "healthEventId": - err = unpopulate(val, "HealthEventID", &a.HealthEventID) - delete(rawMsg, key) - case "healthEventType": - err = unpopulate(val, "HealthEventType", &a.HealthEventType) - delete(rawMsg, key) - case "occurredTime": - err = unpopulateTimeRFC3339(val, "OccurredTime", &a.OccurredTime) - delete(rawMsg, key) - case "reasonChronicity": - err = unpopulate(val, "ReasonChronicity", &a.ReasonChronicity) - delete(rawMsg, key) - case "reasonType": - err = unpopulate(val, "ReasonType", &a.ReasonType) - delete(rawMsg, key) - case "recentlyResolved": - err = unpopulate(val, "RecentlyResolved", &a.RecentlyResolved) - delete(rawMsg, key) - case "recommendedActions": - err = unpopulate(val, "RecommendedActions", &a.RecommendedActions) - delete(rawMsg, key) - case "reportedTime": - err = unpopulateTimeRFC3339(val, "ReportedTime", &a.ReportedTime) - delete(rawMsg, key) - case "resolutionETA": - err = unpopulateTimeRFC3339(val, "ResolutionETA", &a.ResolutionETA) - delete(rawMsg, key) - case "rootCauseAttributionTime": - err = unpopulateTimeRFC3339(val, "RootCauseAttributionTime", &a.RootCauseAttributionTime) - delete(rawMsg, key) - 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 -} - -// 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 "unavailabilitySummary": - err = unpopulate(val, "UnavailabilitySummary", &a.UnavailabilitySummary) - delete(rawMsg, key) - case "unavailableOccurredTime": - err = unpopulateTimeRFC3339(val, "UnavailableOccurredTime", &a.UnavailableOccurredTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImpactedResourceStatusProperties. -func (i *ImpactedResourceStatusProperties) 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 "availabilityState": - err = unpopulate(val, "AvailabilityState", &i.AvailabilityState) - delete(rawMsg, key) - case "occurredTime": - err = unpopulateTimeRFC3339(val, "OccurredTime", &i.OccurredTime) - delete(rawMsg, key) - case "reasonType": - err = unpopulate(val, "ReasonType", &i.ReasonType) - delete(rawMsg, key) - case "summary": - err = unpopulate(val, "Summary", &i.Summary) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &i.Title) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceImpactingEvent. -func (s *ServiceImpactingEvent) 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 "correlationId": - err = unpopulate(val, "CorrelationID", &s.CorrelationID) - delete(rawMsg, key) - case "eventStartTime": - err = unpopulateTimeRFC3339(val, "EventStartTime", &s.EventStartTime) - delete(rawMsg, key) - case "eventStatusLastModifiedTime": - err = unpopulateTimeRFC3339(val, "EventStatusLastModifiedTime", &s.EventStatusLastModifiedTime) - delete(rawMsg, key) - case "incidentProperties": - err = unpopulate(val, "IncidentProperties", &s.IncidentProperties) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StatusBanner. -func (s *StatusBanner) 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 "lastModifiedTime": - err = unpopulateTimeRFC3339(val, "LastModifiedTime", &s.LastModifiedTime) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &s.Message) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &s.Title) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}