diff --git a/sdk/resourcemanager/support/armsupport/CHANGELOG.md b/sdk/resourcemanager/support/armsupport/CHANGELOG.md index e5155dc8bd09..b9b25847d3a2 100644 --- a/sdk/resourcemanager/support/armsupport/CHANGELOG.md +++ b/sdk/resourcemanager/support/armsupport/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History +## 1.1.0 (2023-03-28) +### Features Added + +- New function `NewClientFactory(string, azcore.TokenCredential, *arm.ClientOptions) (*ClientFactory, error)` +- New function `*ClientFactory.NewCommunicationsClient() *CommunicationsClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewProblemClassificationsClient() *ProblemClassificationsClient` +- New function `*ClientFactory.NewServicesClient() *ServicesClient` +- New function `*ClientFactory.NewTicketsClient() *TicketsClient` +- New struct `ClientFactory` + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport` 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/support/armsupport/autorest.md b/sdk/resourcemanager/support/armsupport/autorest.md index 4f003a9f4dcf..c4fbf30ad1b0 100644 --- a/sdk/resourcemanager/support/armsupport/autorest.md +++ b/sdk/resourcemanager/support/armsupport/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/support/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/support/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.1.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/support/armsupport/client_factory.go b/sdk/resourcemanager/support/armsupport/client_factory.go new file mode 100644 index 000000000000..e101d91ffc70 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/client_factory.go @@ -0,0 +1,64 @@ +//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 armsupport + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// 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 - Azure subscription Id. +// - 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) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServicesClient() *ServicesClient { + subClient, _ := NewServicesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProblemClassificationsClient() *ProblemClassificationsClient { + subClient, _ := NewProblemClassificationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTicketsClient() *TicketsClient { + subClient, _ := NewTicketsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCommunicationsClient() *CommunicationsClient { + subClient, _ := NewCommunicationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/support/armsupport/zz_generated_communications_client.go b/sdk/resourcemanager/support/armsupport/communications_client.go similarity index 85% rename from sdk/resourcemanager/support/armsupport/zz_generated_communications_client.go rename to sdk/resourcemanager/support/armsupport/communications_client.go index 61409eed6864..77c8e8a43193 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_communications_client.go +++ b/sdk/resourcemanager/support/armsupport/communications_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 armsupport @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,31 +25,22 @@ import ( // CommunicationsClient contains the methods for the Communications group. // Don't use this type directly, use NewCommunicationsClient() instead. type CommunicationsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewCommunicationsClient creates a new instance of CommunicationsClient with the specified values. -// subscriptionID - Azure subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Azure subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewCommunicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunicationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".CommunicationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &CommunicationsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -58,17 +48,18 @@ func NewCommunicationsClient(subscriptionID string, credential azcore.TokenCrede // CheckNameAvailability - Check the availability of a resource name. This API should be used to check the uniqueness of the // name for adding a new communication to the support ticket. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// supportTicketName - Support ticket name. -// checkNameAvailabilityInput - Input to check. -// options - CommunicationsClientCheckNameAvailabilityOptions contains the optional parameters for the CommunicationsClient.CheckNameAvailability -// method. +// - supportTicketName - Support ticket name. +// - checkNameAvailabilityInput - Input to check. +// - options - CommunicationsClientCheckNameAvailabilityOptions contains the optional parameters for the CommunicationsClient.CheckNameAvailability +// method. func (client *CommunicationsClient) CheckNameAvailability(ctx context.Context, supportTicketName string, checkNameAvailabilityInput CheckNameAvailabilityInput, options *CommunicationsClientCheckNameAvailabilityOptions) (CommunicationsClientCheckNameAvailabilityResponse, error) { req, err := client.checkNameAvailabilityCreateRequest(ctx, supportTicketName, checkNameAvailabilityInput, options) if err != nil { return CommunicationsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return CommunicationsClientCheckNameAvailabilityResponse{}, err } @@ -89,7 +80,7 @@ func (client *CommunicationsClient) checkNameAvailabilityCreateRequest(ctx conte 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.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -111,35 +102,37 @@ func (client *CommunicationsClient) checkNameAvailabilityHandleResponse(resp *ht // BeginCreate - Adds a new customer communication to an Azure support ticket. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// supportTicketName - Support ticket name. -// communicationName - Communication name. -// createCommunicationParameters - Communication object. -// options - CommunicationsClientBeginCreateOptions contains the optional parameters for the CommunicationsClient.BeginCreate -// method. +// - supportTicketName - Support ticket name. +// - communicationName - Communication name. +// - createCommunicationParameters - Communication object. +// - options - CommunicationsClientBeginCreateOptions contains the optional parameters for the CommunicationsClient.BeginCreate +// method. func (client *CommunicationsClient) BeginCreate(ctx context.Context, supportTicketName string, communicationName string, createCommunicationParameters CommunicationDetails, options *CommunicationsClientBeginCreateOptions) (*runtime.Poller[CommunicationsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, supportTicketName, communicationName, createCommunicationParameters, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CommunicationsClientCreateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommunicationsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[CommunicationsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[CommunicationsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - Adds a new customer communication to an Azure support ticket. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 func (client *CommunicationsClient) create(ctx context.Context, supportTicketName string, communicationName string, createCommunicationParameters CommunicationDetails, options *CommunicationsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, supportTicketName, communicationName, createCommunicationParameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -164,7 +157,7 @@ func (client *CommunicationsClient) createCreateRequest(ctx context.Context, sup 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.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -177,16 +170,17 @@ func (client *CommunicationsClient) createCreateRequest(ctx context.Context, sup // Get - Returns communication details for a support ticket. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// supportTicketName - Support ticket name. -// communicationName - Communication name. -// options - CommunicationsClientGetOptions contains the optional parameters for the CommunicationsClient.Get method. +// - supportTicketName - Support ticket name. +// - communicationName - Communication name. +// - options - CommunicationsClientGetOptions contains the optional parameters for the CommunicationsClient.Get method. func (client *CommunicationsClient) Get(ctx context.Context, supportTicketName string, communicationName string, options *CommunicationsClientGetOptions) (CommunicationsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, supportTicketName, communicationName, options) if err != nil { return CommunicationsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return CommunicationsClientGetResponse{}, err } @@ -211,7 +205,7 @@ func (client *CommunicationsClient) getCreateRequest(ctx context.Context, suppor 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -237,10 +231,10 @@ func (client *CommunicationsClient) getHandleResponse(resp *http.Response) (Comm // with nextLink, using which you can retrieve the next set of Communication results. // Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, // a request for data might cause an error. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// supportTicketName - Support ticket name. -// options - CommunicationsClientListOptions contains the optional parameters for the CommunicationsClient.List method. +// - supportTicketName - Support ticket name. +// - options - CommunicationsClientListOptions contains the optional parameters for the CommunicationsClient.NewListPager method. func (client *CommunicationsClient) NewListPager(supportTicketName string, options *CommunicationsClientListOptions) *runtime.Pager[CommunicationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[CommunicationsClientListResponse]{ More: func(page CommunicationsClientListResponse) bool { @@ -257,7 +251,7 @@ func (client *CommunicationsClient) NewListPager(supportTicketName string, optio if err != nil { return CommunicationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return CommunicationsClientListResponse{}, err } @@ -280,7 +274,7 @@ func (client *CommunicationsClient) listCreateRequest(ctx context.Context, suppo 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/support/armsupport/zz_generated_constants.go b/sdk/resourcemanager/support/armsupport/constants.go similarity index 98% rename from sdk/resourcemanager/support/armsupport/zz_generated_constants.go rename to sdk/resourcemanager/support/armsupport/constants.go index 9ee2920fb080..5b8e264d2898 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_constants.go +++ b/sdk/resourcemanager/support/armsupport/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 armsupport const ( moduleName = "armsupport" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // CommunicationDirection - Direction of communication. diff --git a/sdk/resourcemanager/support/armsupport/go.mod b/sdk/resourcemanager/support/armsupport/go.mod index c083a4f9a02a..37718a4b332c 100644 --- a/sdk/resourcemanager/support/armsupport/go.mod +++ b/sdk/resourcemanager/support/armsupport/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport 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.4.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 - 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 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/text v0.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/support/armsupport/go.sum b/sdk/resourcemanager/support/armsupport/go.sum index ed5b814680ee..f54c298864a1 100644 --- a/sdk/resourcemanager/support/armsupport/go.sum +++ b/sdk/resourcemanager/support/armsupport/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/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/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= 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= +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/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +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/support/armsupport/zz_generated_models.go b/sdk/resourcemanager/support/armsupport/models.go similarity index 97% rename from sdk/resourcemanager/support/armsupport/zz_generated_models.go rename to sdk/resourcemanager/support/armsupport/models.go index 62277ab70d69..13e5a457de22 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_models.go +++ b/sdk/resourcemanager/support/armsupport/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 armsupport @@ -84,7 +85,7 @@ type CommunicationsClientGetOptions struct { // placeholder for future optional parameters } -// CommunicationsClientListOptions contains the optional parameters for the CommunicationsClient.List method. +// CommunicationsClientListOptions contains the optional parameters for the CommunicationsClient.NewListPager method. type CommunicationsClientListOptions struct { // The filter to apply on the operation. You can filter by communicationType and createdDate properties. CommunicationType // supports Equals ('eq') operator and createdDate supports Greater Than ('gt') and @@ -175,7 +176,7 @@ type OperationDisplay struct { Resource *string `json:"resource,omitempty" azure:"ro"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -212,7 +213,8 @@ type ProblemClassificationsClientGetOptions struct { // placeholder for future optional parameters } -// ProblemClassificationsClientListOptions contains the optional parameters for the ProblemClassificationsClient.List method. +// ProblemClassificationsClientListOptions contains the optional parameters for the ProblemClassificationsClient.NewListPager +// method. type ProblemClassificationsClientListOptions struct { // placeholder for future optional parameters } @@ -314,7 +316,7 @@ type ServicesClientGetOptions struct { // placeholder for future optional parameters } -// ServicesClientListOptions contains the optional parameters for the ServicesClient.List method. +// ServicesClientListOptions contains the optional parameters for the ServicesClient.NewListPager method. type ServicesClientListOptions struct { // placeholder for future optional parameters } @@ -431,12 +433,13 @@ type TicketsClientGetOptions struct { // placeholder for future optional parameters } -// TicketsClientListOptions contains the optional parameters for the TicketsClient.List method. +// TicketsClientListOptions contains the optional parameters for the TicketsClient.NewListPager method. type TicketsClientListOptions struct { // The filter to apply on the operation. We support 'odata v4.0' filter semantics. Learn more [https://docs.microsoft.com/odata/concepts/queryoptions-overview]. - // Status filter can only be used with Equals - // ('eq') operator. For CreatedDate filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). - // When using both filters, combine them using the logical 'AND'. + // Status, ServiceId, and + // ProblemClassificationId filters can only be used with Equals ('eq') operator. For CreatedDate filter, the supported operators + // are Greater Than ('gt') and Greater Than or Equals ('ge'). When using both + // filters, combine them using the logical 'AND'. Filter *string // The number of values to return in the collection. Default is 25 and max is 100. Top *int32 diff --git a/sdk/resourcemanager/support/armsupport/models_serde.go b/sdk/resourcemanager/support/armsupport/models_serde.go new file mode 100644 index 000000000000..a0051fd36ad2 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/models_serde.go @@ -0,0 +1,1089 @@ +//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 armsupport + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityInput. +func (c CheckNameAvailabilityInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityInput. +func (c *CheckNameAvailabilityInput) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityOutput. +func (c CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityOutput. +func (c *CheckNameAvailabilityOutput) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunicationDetails. +func (c CommunicationDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunicationDetails. +func (c *CommunicationDetails) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunicationDetailsProperties. +func (c CommunicationDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "body", c.Body) + populate(objectMap, "communicationDirection", c.CommunicationDirection) + populate(objectMap, "communicationType", c.CommunicationType) + populateTimeRFC3339(objectMap, "createdDate", c.CreatedDate) + populate(objectMap, "sender", c.Sender) + populate(objectMap, "subject", c.Subject) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunicationDetailsProperties. +func (c *CommunicationDetailsProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "body": + err = unpopulate(val, "Body", &c.Body) + delete(rawMsg, key) + case "communicationDirection": + err = unpopulate(val, "CommunicationDirection", &c.CommunicationDirection) + delete(rawMsg, key) + case "communicationType": + err = unpopulate(val, "CommunicationType", &c.CommunicationType) + delete(rawMsg, key) + case "createdDate": + err = unpopulateTimeRFC3339(val, "CreatedDate", &c.CreatedDate) + delete(rawMsg, key) + case "sender": + err = unpopulate(val, "Sender", &c.Sender) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &c.Subject) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunicationsListResult. +func (c CommunicationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunicationsListResult. +func (c *CommunicationsListResult) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactProfile. +func (c ContactProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalEmailAddresses", c.AdditionalEmailAddresses) + populate(objectMap, "country", c.Country) + populate(objectMap, "firstName", c.FirstName) + populate(objectMap, "lastName", c.LastName) + populate(objectMap, "phoneNumber", c.PhoneNumber) + populate(objectMap, "preferredContactMethod", c.PreferredContactMethod) + populate(objectMap, "preferredSupportLanguage", c.PreferredSupportLanguage) + populate(objectMap, "preferredTimeZone", c.PreferredTimeZone) + populate(objectMap, "primaryEmailAddress", c.PrimaryEmailAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfile. +func (c *ContactProfile) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalEmailAddresses": + err = unpopulate(val, "AdditionalEmailAddresses", &c.AdditionalEmailAddresses) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &c.Country) + delete(rawMsg, key) + case "firstName": + err = unpopulate(val, "FirstName", &c.FirstName) + delete(rawMsg, key) + case "lastName": + err = unpopulate(val, "LastName", &c.LastName) + delete(rawMsg, key) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &c.PhoneNumber) + delete(rawMsg, key) + case "preferredContactMethod": + err = unpopulate(val, "PreferredContactMethod", &c.PreferredContactMethod) + delete(rawMsg, key) + case "preferredSupportLanguage": + err = unpopulate(val, "PreferredSupportLanguage", &c.PreferredSupportLanguage) + delete(rawMsg, key) + case "preferredTimeZone": + err = unpopulate(val, "PreferredTimeZone", &c.PreferredTimeZone) + delete(rawMsg, key) + case "primaryEmailAddress": + err = unpopulate(val, "PrimaryEmailAddress", &c.PrimaryEmailAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Engineer. +func (e Engineer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "emailAddress", e.EmailAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Engineer. +func (e *Engineer) 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 "emailAddress": + err = unpopulate(val, "EmailAddress", &e.EmailAddress) + 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 ExceptionResponse. +func (e ExceptionResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExceptionResponse. +func (e *ExceptionResponse) 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 "error": + err = unpopulate(val, "Error", &e.Error) + 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 Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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 OperationsListResult. +func (o OperationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsListResult. +func (o *OperationsListResult) 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 ProblemClassification. +func (p ProblemClassification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProblemClassification. +func (p *ProblemClassification) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProblemClassificationProperties. +func (p ProblemClassificationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProblemClassificationProperties. +func (p *ProblemClassificationProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProblemClassificationsListResult. +func (p ProblemClassificationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProblemClassificationsListResult. +func (p *ProblemClassificationsListResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaChangeRequest. +func (q QuotaChangeRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "payload", q.Payload) + populate(objectMap, "region", q.Region) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaChangeRequest. +func (q *QuotaChangeRequest) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "payload": + err = unpopulate(val, "Payload", &q.Payload) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &q.Region) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaTicketDetails. +func (q QuotaTicketDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "quotaChangeRequestSubType", q.QuotaChangeRequestSubType) + populate(objectMap, "quotaChangeRequestVersion", q.QuotaChangeRequestVersion) + populate(objectMap, "quotaChangeRequests", q.QuotaChangeRequests) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaTicketDetails. +func (q *QuotaTicketDetails) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "quotaChangeRequestSubType": + err = unpopulate(val, "QuotaChangeRequestSubType", &q.QuotaChangeRequestSubType) + delete(rawMsg, key) + case "quotaChangeRequestVersion": + err = unpopulate(val, "QuotaChangeRequestVersion", &q.QuotaChangeRequestVersion) + delete(rawMsg, key) + case "quotaChangeRequests": + err = unpopulate(val, "QuotaChangeRequests", &q.QuotaChangeRequests) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Service. +func (s Service) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Service. +func (s *Service) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + 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 ServiceError. +func (s ServiceError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", s.Code) + populate(objectMap, "details", s.Details) + populate(objectMap, "message", s.Message) + populate(objectMap, "target", s.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceError. +func (s *ServiceError) 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 "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &s.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &s.Target) + 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 ServiceErrorDetail. +func (s ServiceErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", s.Code) + populate(objectMap, "message", s.Message) + populate(objectMap, "target", s.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceErrorDetail. +func (s *ServiceErrorDetail) 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 "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &s.Target) + 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 ServiceLevelAgreement. +func (s ServiceLevelAgreement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "expirationTime", s.ExpirationTime) + populate(objectMap, "slaMinutes", s.SLAMinutes) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceLevelAgreement. +func (s *ServiceLevelAgreement) 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 "expirationTime": + err = unpopulateTimeRFC3339(val, "ExpirationTime", &s.ExpirationTime) + delete(rawMsg, key) + case "slaMinutes": + err = unpopulate(val, "SLAMinutes", &s.SLAMinutes) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) + 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 ServiceProperties. +func (s ServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "resourceTypes", s.ResourceTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceProperties. +func (s *ServiceProperties) 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 "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "resourceTypes": + err = unpopulate(val, "ResourceTypes", &s.ResourceTypes) + 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 ServicesListResult. +func (s ServicesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServicesListResult. +func (s *ServicesListResult) 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 TechnicalTicketDetails. +func (t TechnicalTicketDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceId", t.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TechnicalTicketDetails. +func (t *TechnicalTicketDetails) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourceId": + err = unpopulate(val, "ResourceID", &t.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TicketDetails. +func (t TicketDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TicketDetails. +func (t *TicketDetails) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TicketDetailsProperties. +func (t TicketDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contactDetails", t.ContactDetails) + populateTimeRFC3339(objectMap, "createdDate", t.CreatedDate) + populate(objectMap, "description", t.Description) + populate(objectMap, "enrollmentId", t.EnrollmentID) + populateTimeRFC3339(objectMap, "modifiedDate", t.ModifiedDate) + populate(objectMap, "problemClassificationDisplayName", t.ProblemClassificationDisplayName) + populate(objectMap, "problemClassificationId", t.ProblemClassificationID) + populateTimeRFC3339(objectMap, "problemStartTime", t.ProblemStartTime) + populate(objectMap, "quotaTicketDetails", t.QuotaTicketDetails) + populate(objectMap, "require24X7Response", t.Require24X7Response) + populate(objectMap, "serviceDisplayName", t.ServiceDisplayName) + populate(objectMap, "serviceId", t.ServiceID) + populate(objectMap, "serviceLevelAgreement", t.ServiceLevelAgreement) + populate(objectMap, "severity", t.Severity) + populate(objectMap, "status", t.Status) + populate(objectMap, "supportEngineer", t.SupportEngineer) + populate(objectMap, "supportPlanType", t.SupportPlanType) + populate(objectMap, "supportTicketId", t.SupportTicketID) + populate(objectMap, "technicalTicketDetails", t.TechnicalTicketDetails) + populate(objectMap, "title", t.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TicketDetailsProperties. +func (t *TicketDetailsProperties) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contactDetails": + err = unpopulate(val, "ContactDetails", &t.ContactDetails) + delete(rawMsg, key) + case "createdDate": + err = unpopulateTimeRFC3339(val, "CreatedDate", &t.CreatedDate) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "enrollmentId": + err = unpopulate(val, "EnrollmentID", &t.EnrollmentID) + delete(rawMsg, key) + case "modifiedDate": + err = unpopulateTimeRFC3339(val, "ModifiedDate", &t.ModifiedDate) + delete(rawMsg, key) + case "problemClassificationDisplayName": + err = unpopulate(val, "ProblemClassificationDisplayName", &t.ProblemClassificationDisplayName) + delete(rawMsg, key) + case "problemClassificationId": + err = unpopulate(val, "ProblemClassificationID", &t.ProblemClassificationID) + delete(rawMsg, key) + case "problemStartTime": + err = unpopulateTimeRFC3339(val, "ProblemStartTime", &t.ProblemStartTime) + delete(rawMsg, key) + case "quotaTicketDetails": + err = unpopulate(val, "QuotaTicketDetails", &t.QuotaTicketDetails) + delete(rawMsg, key) + case "require24X7Response": + err = unpopulate(val, "Require24X7Response", &t.Require24X7Response) + delete(rawMsg, key) + case "serviceDisplayName": + err = unpopulate(val, "ServiceDisplayName", &t.ServiceDisplayName) + delete(rawMsg, key) + case "serviceId": + err = unpopulate(val, "ServiceID", &t.ServiceID) + delete(rawMsg, key) + case "serviceLevelAgreement": + err = unpopulate(val, "ServiceLevelAgreement", &t.ServiceLevelAgreement) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &t.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + case "supportEngineer": + err = unpopulate(val, "SupportEngineer", &t.SupportEngineer) + delete(rawMsg, key) + case "supportPlanType": + err = unpopulate(val, "SupportPlanType", &t.SupportPlanType) + delete(rawMsg, key) + case "supportTicketId": + err = unpopulate(val, "SupportTicketID", &t.SupportTicketID) + delete(rawMsg, key) + case "technicalTicketDetails": + err = unpopulate(val, "TechnicalTicketDetails", &t.TechnicalTicketDetails) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &t.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TicketsListResult. +func (t TicketsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TicketsListResult. +func (t *TicketsListResult) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateContactProfile. +func (u UpdateContactProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalEmailAddresses", u.AdditionalEmailAddresses) + populate(objectMap, "country", u.Country) + populate(objectMap, "firstName", u.FirstName) + populate(objectMap, "lastName", u.LastName) + populate(objectMap, "phoneNumber", u.PhoneNumber) + populate(objectMap, "preferredContactMethod", u.PreferredContactMethod) + populate(objectMap, "preferredSupportLanguage", u.PreferredSupportLanguage) + populate(objectMap, "preferredTimeZone", u.PreferredTimeZone) + populate(objectMap, "primaryEmailAddress", u.PrimaryEmailAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateContactProfile. +func (u *UpdateContactProfile) 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 "additionalEmailAddresses": + err = unpopulate(val, "AdditionalEmailAddresses", &u.AdditionalEmailAddresses) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &u.Country) + delete(rawMsg, key) + case "firstName": + err = unpopulate(val, "FirstName", &u.FirstName) + delete(rawMsg, key) + case "lastName": + err = unpopulate(val, "LastName", &u.LastName) + delete(rawMsg, key) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &u.PhoneNumber) + delete(rawMsg, key) + case "preferredContactMethod": + err = unpopulate(val, "PreferredContactMethod", &u.PreferredContactMethod) + delete(rawMsg, key) + case "preferredSupportLanguage": + err = unpopulate(val, "PreferredSupportLanguage", &u.PreferredSupportLanguage) + delete(rawMsg, key) + case "preferredTimeZone": + err = unpopulate(val, "PreferredTimeZone", &u.PreferredTimeZone) + delete(rawMsg, key) + case "primaryEmailAddress": + err = unpopulate(val, "PrimaryEmailAddress", &u.PrimaryEmailAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateSupportTicket. +func (u UpdateSupportTicket) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contactDetails", u.ContactDetails) + populate(objectMap, "severity", u.Severity) + populate(objectMap, "status", u.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSupportTicket. +func (u *UpdateSupportTicket) 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 "contactDetails": + err = unpopulate(val, "ContactDetails", &u.ContactDetails) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &u.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &u.Status) + 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 + } 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 any) 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/support/armsupport/zz_generated_operations_client.go b/sdk/resourcemanager/support/armsupport/operations_client.go similarity index 76% rename from sdk/resourcemanager/support/armsupport/zz_generated_operations_client.go rename to sdk/resourcemanager/support/armsupport/operations_client.go index b7a661ec5cfa..5fd6fd382221 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_operations_client.go +++ b/sdk/resourcemanager/support/armsupport/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 armsupport @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -22,36 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - This lists all the available Microsoft Support REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -62,7 +52,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -77,7 +67,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Support/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/support/armsupport/zz_generated_problemclassifications_client.go b/sdk/resourcemanager/support/armsupport/problemclassifications_client.go similarity index 81% rename from sdk/resourcemanager/support/armsupport/zz_generated_problemclassifications_client.go rename to sdk/resourcemanager/support/armsupport/problemclassifications_client.go index 0fc165e41446..71fde6370e07 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_problemclassifications_client.go +++ b/sdk/resourcemanager/support/armsupport/problemclassifications_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 armsupport @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,45 +24,37 @@ import ( // ProblemClassificationsClient contains the methods for the ProblemClassifications group. // Don't use this type directly, use NewProblemClassificationsClient() instead. type ProblemClassificationsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewProblemClassificationsClient creates a new instance of ProblemClassificationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewProblemClassificationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ProblemClassificationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ProblemClassificationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ProblemClassificationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Get problem classification details for a specific Azure service. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// serviceName - Name of the Azure service available for support. -// problemClassificationName - Name of problem classification. -// options - ProblemClassificationsClientGetOptions contains the optional parameters for the ProblemClassificationsClient.Get -// method. +// - serviceName - Name of the Azure service available for support. +// - problemClassificationName - Name of problem classification. +// - options - ProblemClassificationsClientGetOptions contains the optional parameters for the ProblemClassificationsClient.Get +// method. func (client *ProblemClassificationsClient) Get(ctx context.Context, serviceName string, problemClassificationName string, options *ProblemClassificationsClientGetOptions) (ProblemClassificationsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, serviceName, problemClassificationName, options) if err != nil { return ProblemClassificationsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProblemClassificationsClientGetResponse{}, err } @@ -84,7 +75,7 @@ func (client *ProblemClassificationsClient) getCreateRequest(ctx context.Context return nil, errors.New("parameter problemClassificationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{problemClassificationName}", url.PathEscape(problemClassificationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -107,11 +98,11 @@ func (client *ProblemClassificationsClient) getHandleResponse(resp *http.Respons // NewListPager - Lists all the problem classifications (categories) available for a specific Azure service. Always use the // service and problem classifications obtained programmatically. This practice ensures that you // always have the most recent set of service and problem classification Ids. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// serviceName - Name of the Azure service for which the problem classifications need to be retrieved. -// options - ProblemClassificationsClientListOptions contains the optional parameters for the ProblemClassificationsClient.List -// method. +// - serviceName - Name of the Azure service for which the problem classifications need to be retrieved. +// - options - ProblemClassificationsClientListOptions contains the optional parameters for the ProblemClassificationsClient.NewListPager +// method. func (client *ProblemClassificationsClient) NewListPager(serviceName string, options *ProblemClassificationsClientListOptions) *runtime.Pager[ProblemClassificationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ProblemClassificationsClientListResponse]{ More: func(page ProblemClassificationsClientListResponse) bool { @@ -122,7 +113,7 @@ func (client *ProblemClassificationsClient) NewListPager(serviceName string, opt if err != nil { return ProblemClassificationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProblemClassificationsClientListResponse{}, err } @@ -141,7 +132,7 @@ func (client *ProblemClassificationsClient) listCreateRequest(ctx context.Contex return nil, errors.New("parameter serviceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/support/armsupport/zz_generated_response_types.go b/sdk/resourcemanager/support/armsupport/response_types.go similarity index 90% rename from sdk/resourcemanager/support/armsupport/zz_generated_response_types.go rename to sdk/resourcemanager/support/armsupport/response_types.go index b985c2dd2f06..f2ec9995d055 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_response_types.go +++ b/sdk/resourcemanager/support/armsupport/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 armsupport @@ -13,7 +14,7 @@ type CommunicationsClientCheckNameAvailabilityResponse struct { CheckNameAvailabilityOutput } -// CommunicationsClientCreateResponse contains the response from method CommunicationsClient.Create. +// CommunicationsClientCreateResponse contains the response from method CommunicationsClient.BeginCreate. type CommunicationsClientCreateResponse struct { CommunicationDetails } @@ -23,12 +24,12 @@ type CommunicationsClientGetResponse struct { CommunicationDetails } -// CommunicationsClientListResponse contains the response from method CommunicationsClient.List. +// CommunicationsClientListResponse contains the response from method CommunicationsClient.NewListPager. type CommunicationsClientListResponse struct { CommunicationsListResult } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationsListResult } @@ -38,7 +39,7 @@ type ProblemClassificationsClientGetResponse struct { ProblemClassification } -// ProblemClassificationsClientListResponse contains the response from method ProblemClassificationsClient.List. +// ProblemClassificationsClientListResponse contains the response from method ProblemClassificationsClient.NewListPager. type ProblemClassificationsClientListResponse struct { ProblemClassificationsListResult } @@ -48,7 +49,7 @@ type ServicesClientGetResponse struct { Service } -// ServicesClientListResponse contains the response from method ServicesClient.List. +// ServicesClientListResponse contains the response from method ServicesClient.NewListPager. type ServicesClientListResponse struct { ServicesListResult } @@ -58,7 +59,7 @@ type TicketsClientCheckNameAvailabilityResponse struct { CheckNameAvailabilityOutput } -// TicketsClientCreateResponse contains the response from method TicketsClient.Create. +// TicketsClientCreateResponse contains the response from method TicketsClient.BeginCreate. type TicketsClientCreateResponse struct { TicketDetails } @@ -68,7 +69,7 @@ type TicketsClientGetResponse struct { TicketDetails } -// TicketsClientListResponse contains the response from method TicketsClient.List. +// TicketsClientListResponse contains the response from method TicketsClient.NewListPager. type TicketsClientListResponse struct { TicketsListResult } diff --git a/sdk/resourcemanager/support/armsupport/zz_generated_services_client.go b/sdk/resourcemanager/support/armsupport/services_client.go similarity index 82% rename from sdk/resourcemanager/support/armsupport/zz_generated_services_client.go rename to sdk/resourcemanager/support/armsupport/services_client.go index 816f558b82d0..f1052ce884ba 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_services_client.go +++ b/sdk/resourcemanager/support/armsupport/services_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 armsupport @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,43 +24,35 @@ import ( // ServicesClient contains the methods for the Services group. // Don't use this type directly, use NewServicesClient() instead. type ServicesClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewServicesClient creates a new instance of ServicesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewServicesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ServicesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ServicesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ServicesClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Gets a specific Azure service for support ticket creation. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// serviceName - Name of the Azure service. -// options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. +// - serviceName - Name of the Azure service. +// - options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. func (client *ServicesClient) Get(ctx context.Context, serviceName string, options *ServicesClientGetOptions) (ServicesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, serviceName, options) if err != nil { return ServicesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientGetResponse{}, err } @@ -78,7 +69,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, serviceName return nil, errors.New("parameter serviceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -104,9 +95,9 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl // page. Always use the service and its corresponding problem classification(s) // obtained programmatically for support ticket creation. This practice ensures that you always have the most recent set of // service and problem classification Ids. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// options - ServicesClientListOptions contains the optional parameters for the ServicesClient.List method. +// - options - ServicesClientListOptions contains the optional parameters for the ServicesClient.NewListPager method. func (client *ServicesClient) NewListPager(options *ServicesClientListOptions) *runtime.Pager[ServicesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ServicesClientListResponse]{ More: func(page ServicesClientListResponse) bool { @@ -117,7 +108,7 @@ func (client *ServicesClient) NewListPager(options *ServicesClientListOptions) * if err != nil { return ServicesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientListResponse{}, err } @@ -132,7 +123,7 @@ func (client *ServicesClient) NewListPager(options *ServicesClientListOptions) * // listCreateRequest creates the List request. func (client *ServicesClient) listCreateRequest(ctx context.Context, options *ServicesClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Support/services" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/support/armsupport/zz_generated_tickets_client.go b/sdk/resourcemanager/support/armsupport/tickets_client.go similarity index 87% rename from sdk/resourcemanager/support/armsupport/zz_generated_tickets_client.go rename to sdk/resourcemanager/support/armsupport/tickets_client.go index 55ad77c73ba2..ba5486d6f2c7 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_tickets_client.go +++ b/sdk/resourcemanager/support/armsupport/tickets_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 armsupport @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,31 +25,22 @@ import ( // TicketsClient contains the methods for the SupportTickets group. // Don't use this type directly, use NewTicketsClient() instead. type TicketsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewTicketsClient creates a new instance of TicketsClient with the specified values. -// subscriptionID - Azure subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Azure subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewTicketsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TicketsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".TicketsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &TicketsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -58,16 +48,17 @@ func NewTicketsClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Check the availability of a resource name. This API should be used to check the uniqueness of the // name for support ticket creation for the selected subscription. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// checkNameAvailabilityInput - Input to check. -// options - TicketsClientCheckNameAvailabilityOptions contains the optional parameters for the TicketsClient.CheckNameAvailability -// method. +// - checkNameAvailabilityInput - Input to check. +// - options - TicketsClientCheckNameAvailabilityOptions contains the optional parameters for the TicketsClient.CheckNameAvailability +// method. func (client *TicketsClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput, options *TicketsClientCheckNameAvailabilityOptions) (TicketsClientCheckNameAvailabilityResponse, error) { req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityInput, options) if err != nil { return TicketsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return TicketsClientCheckNameAvailabilityResponse{}, err } @@ -84,7 +75,7 @@ func (client *TicketsClient) checkNameAvailabilityCreateRequest(ctx context.Cont 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.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -123,21 +114,22 @@ func (client *TicketsClient) checkNameAvailabilityHandleResponse(resp *http.Resp // subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be from the Cloud solution provider // (CSP) partner tenant. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// supportTicketName - Support ticket name. -// createSupportTicketParameters - Support ticket request payload. -// options - TicketsClientBeginCreateOptions contains the optional parameters for the TicketsClient.BeginCreate method. +// - supportTicketName - Support ticket name. +// - createSupportTicketParameters - Support ticket request payload. +// - options - TicketsClientBeginCreateOptions contains the optional parameters for the TicketsClient.BeginCreate method. func (client *TicketsClient) BeginCreate(ctx context.Context, supportTicketName string, createSupportTicketParameters TicketDetails, options *TicketsClientBeginCreateOptions) (*runtime.Poller[TicketsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, supportTicketName, createSupportTicketParameters, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[TicketsClientCreateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TicketsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[TicketsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[TicketsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } @@ -160,13 +152,14 @@ func (client *TicketsClient) BeginCreate(ctx context.Context, supportTicketName // subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be from the Cloud solution provider // (CSP) partner tenant. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 func (client *TicketsClient) create(ctx context.Context, supportTicketName string, createSupportTicketParameters TicketDetails, options *TicketsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, supportTicketName, createSupportTicketParameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -187,7 +180,7 @@ func (client *TicketsClient) createCreateRequest(ctx context.Context, supportTic 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.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -202,15 +195,16 @@ func (client *TicketsClient) createCreateRequest(ctx context.Context, supportTic // If a ticket was created more than 18 months ago, a request for data might cause an // error. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// supportTicketName - Support ticket name. -// options - TicketsClientGetOptions contains the optional parameters for the TicketsClient.Get method. +// - supportTicketName - Support ticket name. +// - options - TicketsClientGetOptions contains the optional parameters for the TicketsClient.Get method. func (client *TicketsClient) Get(ctx context.Context, supportTicketName string, options *TicketsClientGetOptions) (TicketsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, supportTicketName, options) if err != nil { return TicketsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return TicketsClientGetResponse{}, err } @@ -231,7 +225,7 @@ func (client *TicketsClient) getCreateRequest(ctx context.Context, supportTicket 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -251,14 +245,14 @@ func (client *TicketsClient) getHandleResponse(resp *http.Response) (TicketsClie return result, nil } -// NewListPager - Lists all the support tickets for an Azure subscription. You can also filter the support tickets by Status -// or CreatedDate using the $filter parameter. Output will be a paged result with nextLink, -// using which you can retrieve the next set of support tickets. +// NewListPager - Lists all the support tickets for an Azure subscription. You can also filter the support tickets by Status, +// CreatedDate, ServiceId, and ProblemClassificationId using the $filter parameter. Output will +// be a paged result with nextLink, using which you can retrieve the next set of support tickets. // Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, // a request for data might cause an error. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// options - TicketsClientListOptions contains the optional parameters for the TicketsClient.List method. +// - options - TicketsClientListOptions contains the optional parameters for the TicketsClient.NewListPager method. func (client *TicketsClient) NewListPager(options *TicketsClientListOptions) *runtime.Pager[TicketsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[TicketsClientListResponse]{ More: func(page TicketsClientListResponse) bool { @@ -275,7 +269,7 @@ func (client *TicketsClient) NewListPager(options *TicketsClientListOptions) *ru if err != nil { return TicketsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return TicketsClientListResponse{}, err } @@ -294,7 +288,7 @@ func (client *TicketsClient) listCreateRequest(ctx context.Context, options *Tic 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -327,16 +321,17 @@ func (client *TicketsClient) listHandleResponse(resp *http.Response) (TicketsCli // Changing the ticket status to closed is allowed only on an unassigned case. When an engineer is actively working on the // ticket, send your ticket closure request by sending a note to your engineer. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-04-01 -// supportTicketName - Support ticket name. -// updateSupportTicket - UpdateSupportTicket object. -// options - TicketsClientUpdateOptions contains the optional parameters for the TicketsClient.Update method. +// - supportTicketName - Support ticket name. +// - updateSupportTicket - UpdateSupportTicket object. +// - options - TicketsClientUpdateOptions contains the optional parameters for the TicketsClient.Update method. func (client *TicketsClient) Update(ctx context.Context, supportTicketName string, updateSupportTicket UpdateSupportTicket, options *TicketsClientUpdateOptions) (TicketsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, supportTicketName, updateSupportTicket, options) if err != nil { return TicketsClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return TicketsClientUpdateResponse{}, err } @@ -357,7 +352,7 @@ func (client *TicketsClient) updateCreateRequest(ctx context.Context, supportTic 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.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/support/armsupport/zz_generated_time_rfc3339.go b/sdk/resourcemanager/support/armsupport/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/support/armsupport/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/support/armsupport/time_rfc3339.go index 80c96440edca..5f0e67da93ce 100644 --- a/sdk/resourcemanager/support/armsupport/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/support/armsupport/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 armsupport @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/support/armsupport/ze_generated_example_communications_client_test.go b/sdk/resourcemanager/support/armsupport/ze_generated_example_communications_client_test.go deleted file mode 100644 index 1d8c2f5a1d9a..000000000000 --- a/sdk/resourcemanager/support/armsupport/ze_generated_example_communications_client_test.go +++ /dev/null @@ -1,125 +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 armsupport_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/support/armsupport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CheckNameAvailabilityForSupportTicketCommunication.json -func ExampleCommunicationsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewCommunicationsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - "testticket", - armsupport.CheckNameAvailabilityInput{ - Name: to.Ptr("sampleName"), - Type: to.Ptr(armsupport.TypeMicrosoftSupportCommunications), - }, - nil) - 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/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListCommunicationsForSubscriptionSupportTicket.json -func ExampleCommunicationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewCommunicationsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("testticket", - &armsupport.CommunicationsClientListOptions{Top: nil, - Filter: 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 - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetCommunicationDetailsForSubscriptionSupportTicket.json -func ExampleCommunicationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewCommunicationsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testticket", - "testmessage", - nil) - 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/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateSupportTicketCommunication.json -func ExampleCommunicationsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewCommunicationsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "testticket", - "testcommunication", - armsupport.CommunicationDetails{ - Properties: &armsupport.CommunicationDetailsProperties{ - Body: to.Ptr("This is a test message from a customer!"), - Sender: to.Ptr("user@contoso.com"), - Subject: to.Ptr("This is a test message from a customer!"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/support/armsupport/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/support/armsupport/ze_generated_example_operations_client_test.go deleted file mode 100644 index bf2c5b248e42..000000000000 --- a/sdk/resourcemanager/support/armsupport/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +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 armsupport_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/support/armsupport/ze_generated_example_problemclassifications_client_test.go b/sdk/resourcemanager/support/armsupport/ze_generated_example_problemclassifications_client_test.go deleted file mode 100644 index 19455cfb0fda..000000000000 --- a/sdk/resourcemanager/support/armsupport/ze_generated_example_problemclassifications_client_test.go +++ /dev/null @@ -1,64 +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 armsupport_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListProblemClassifications.json -func ExampleProblemClassificationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewProblemClassificationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("service_guid", - 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 - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetProblemClassification.json -func ExampleProblemClassificationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewProblemClassificationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "service_guid", - "problemClassification_guid", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/support/armsupport/ze_generated_example_services_client_test.go b/sdk/resourcemanager/support/armsupport/ze_generated_example_services_client_test.go deleted file mode 100644 index d7ab357d1e32..000000000000 --- a/sdk/resourcemanager/support/armsupport/ze_generated_example_services_client_test.go +++ /dev/null @@ -1,62 +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 armsupport_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListServices.json -func ExampleServicesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewServicesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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 - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetService.json -func ExampleServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewServicesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "service_guid", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/support/armsupport/ze_generated_example_supporttickets_client_test.go b/sdk/resourcemanager/support/armsupport/ze_generated_example_supporttickets_client_test.go deleted file mode 100644 index 93dd42d0768b..000000000000 --- a/sdk/resourcemanager/support/armsupport/ze_generated_example_supporttickets_client_test.go +++ /dev/null @@ -1,168 +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 armsupport_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/support/armsupport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CheckNameAvailabilityWithSubscription.json -func ExampleTicketsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewTicketsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - armsupport.CheckNameAvailabilityInput{ - Name: to.Ptr("sampleName"), - Type: to.Ptr(armsupport.TypeMicrosoftSupportSupportTickets), - }, - nil) - 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/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenStateBySubscription.json -func ExampleTicketsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewTicketsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armsupport.TicketsClientListOptions{Top: nil, - Filter: to.Ptr("createdDate ge 2020-03-10T22:08:51Z and status eq 'Open'"), - }) - 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/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetSubscriptionSupportTicketDetails.json -func ExampleTicketsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewTicketsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testticket", - nil) - 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/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/UpdateContactDetailsOfSupportTicketForSubscription.json -func ExampleTicketsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewTicketsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "testticket", - armsupport.UpdateSupportTicket{ - ContactDetails: &armsupport.UpdateContactProfile{ - AdditionalEmailAddresses: []*string{ - to.Ptr("tname@contoso.com"), - to.Ptr("teamtest@contoso.com")}, - Country: to.Ptr("USA"), - FirstName: to.Ptr("first name"), - LastName: to.Ptr("last name"), - PhoneNumber: to.Ptr("123-456-7890"), - PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), - PreferredSupportLanguage: to.Ptr("en-US"), - PreferredTimeZone: to.Ptr("Pacific Standard Time"), - PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), - }, - }, - nil) - 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/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateBillingSupportTicketForSubscription.json -func ExampleTicketsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsupport.NewTicketsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "testticket", - armsupport.TicketDetails{ - Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), - ContactDetails: &armsupport.ContactProfile{ - Country: to.Ptr("usa"), - FirstName: to.Ptr("abc"), - LastName: to.Ptr("xyz"), - PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), - PreferredSupportLanguage: to.Ptr("en-US"), - PreferredTimeZone: to.Ptr("Pacific Standard Time"), - PrimaryEmailAddress: to.Ptr("abc@contoso.com"), - }, - ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid/problemClassifications/billing_problemClassification_guid"), - ServiceID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/support/armsupport/zz_generated_models_serde.go b/sdk/resourcemanager/support/armsupport/zz_generated_models_serde.go deleted file mode 100644 index e76b21dbf984..000000000000 --- a/sdk/resourcemanager/support/armsupport/zz_generated_models_serde.go +++ /dev/null @@ -1,269 +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 armsupport - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type CommunicationDetailsProperties. -func (c CommunicationDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "body", c.Body) - populate(objectMap, "communicationDirection", c.CommunicationDirection) - populate(objectMap, "communicationType", c.CommunicationType) - populateTimeRFC3339(objectMap, "createdDate", c.CreatedDate) - populate(objectMap, "sender", c.Sender) - populate(objectMap, "subject", c.Subject) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CommunicationDetailsProperties. -func (c *CommunicationDetailsProperties) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "body": - err = unpopulate(val, "Body", &c.Body) - delete(rawMsg, key) - case "communicationDirection": - err = unpopulate(val, "CommunicationDirection", &c.CommunicationDirection) - delete(rawMsg, key) - case "communicationType": - err = unpopulate(val, "CommunicationType", &c.CommunicationType) - delete(rawMsg, key) - case "createdDate": - err = unpopulateTimeRFC3339(val, "CreatedDate", &c.CreatedDate) - delete(rawMsg, key) - case "sender": - err = unpopulate(val, "Sender", &c.Sender) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &c.Subject) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ContactProfile. -func (c ContactProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalEmailAddresses", c.AdditionalEmailAddresses) - populate(objectMap, "country", c.Country) - populate(objectMap, "firstName", c.FirstName) - populate(objectMap, "lastName", c.LastName) - populate(objectMap, "phoneNumber", c.PhoneNumber) - populate(objectMap, "preferredContactMethod", c.PreferredContactMethod) - populate(objectMap, "preferredSupportLanguage", c.PreferredSupportLanguage) - populate(objectMap, "preferredTimeZone", c.PreferredTimeZone) - populate(objectMap, "primaryEmailAddress", c.PrimaryEmailAddress) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QuotaTicketDetails. -func (q QuotaTicketDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "quotaChangeRequestSubType", q.QuotaChangeRequestSubType) - populate(objectMap, "quotaChangeRequestVersion", q.QuotaChangeRequestVersion) - populate(objectMap, "quotaChangeRequests", q.QuotaChangeRequests) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServiceLevelAgreement. -func (s ServiceLevelAgreement) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "expirationTime", s.ExpirationTime) - populate(objectMap, "slaMinutes", s.SLAMinutes) - populateTimeRFC3339(objectMap, "startTime", s.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceLevelAgreement. -func (s *ServiceLevelAgreement) 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 "expirationTime": - err = unpopulateTimeRFC3339(val, "ExpirationTime", &s.ExpirationTime) - delete(rawMsg, key) - case "slaMinutes": - err = unpopulate(val, "SLAMinutes", &s.SLAMinutes) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) - 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 TicketDetailsProperties. -func (t TicketDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contactDetails", t.ContactDetails) - populateTimeRFC3339(objectMap, "createdDate", t.CreatedDate) - populate(objectMap, "description", t.Description) - populate(objectMap, "enrollmentId", t.EnrollmentID) - populateTimeRFC3339(objectMap, "modifiedDate", t.ModifiedDate) - populate(objectMap, "problemClassificationDisplayName", t.ProblemClassificationDisplayName) - populate(objectMap, "problemClassificationId", t.ProblemClassificationID) - populateTimeRFC3339(objectMap, "problemStartTime", t.ProblemStartTime) - populate(objectMap, "quotaTicketDetails", t.QuotaTicketDetails) - populate(objectMap, "require24X7Response", t.Require24X7Response) - populate(objectMap, "serviceDisplayName", t.ServiceDisplayName) - populate(objectMap, "serviceId", t.ServiceID) - populate(objectMap, "serviceLevelAgreement", t.ServiceLevelAgreement) - populate(objectMap, "severity", t.Severity) - populate(objectMap, "status", t.Status) - populate(objectMap, "supportEngineer", t.SupportEngineer) - populate(objectMap, "supportPlanType", t.SupportPlanType) - populate(objectMap, "supportTicketId", t.SupportTicketID) - populate(objectMap, "technicalTicketDetails", t.TechnicalTicketDetails) - populate(objectMap, "title", t.Title) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TicketDetailsProperties. -func (t *TicketDetailsProperties) 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", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "contactDetails": - err = unpopulate(val, "ContactDetails", &t.ContactDetails) - delete(rawMsg, key) - case "createdDate": - err = unpopulateTimeRFC3339(val, "CreatedDate", &t.CreatedDate) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "enrollmentId": - err = unpopulate(val, "EnrollmentID", &t.EnrollmentID) - delete(rawMsg, key) - case "modifiedDate": - err = unpopulateTimeRFC3339(val, "ModifiedDate", &t.ModifiedDate) - delete(rawMsg, key) - case "problemClassificationDisplayName": - err = unpopulate(val, "ProblemClassificationDisplayName", &t.ProblemClassificationDisplayName) - delete(rawMsg, key) - case "problemClassificationId": - err = unpopulate(val, "ProblemClassificationID", &t.ProblemClassificationID) - delete(rawMsg, key) - case "problemStartTime": - err = unpopulateTimeRFC3339(val, "ProblemStartTime", &t.ProblemStartTime) - delete(rawMsg, key) - case "quotaTicketDetails": - err = unpopulate(val, "QuotaTicketDetails", &t.QuotaTicketDetails) - delete(rawMsg, key) - case "require24X7Response": - err = unpopulate(val, "Require24X7Response", &t.Require24X7Response) - delete(rawMsg, key) - case "serviceDisplayName": - err = unpopulate(val, "ServiceDisplayName", &t.ServiceDisplayName) - delete(rawMsg, key) - case "serviceId": - err = unpopulate(val, "ServiceID", &t.ServiceID) - delete(rawMsg, key) - case "serviceLevelAgreement": - err = unpopulate(val, "ServiceLevelAgreement", &t.ServiceLevelAgreement) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &t.Severity) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) - delete(rawMsg, key) - case "supportEngineer": - err = unpopulate(val, "SupportEngineer", &t.SupportEngineer) - delete(rawMsg, key) - case "supportPlanType": - err = unpopulate(val, "SupportPlanType", &t.SupportPlanType) - delete(rawMsg, key) - case "supportTicketId": - err = unpopulate(val, "SupportTicketID", &t.SupportTicketID) - delete(rawMsg, key) - case "technicalTicketDetails": - err = unpopulate(val, "TechnicalTicketDetails", &t.TechnicalTicketDetails) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &t.Title) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UpdateContactProfile. -func (u UpdateContactProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalEmailAddresses", u.AdditionalEmailAddresses) - populate(objectMap, "country", u.Country) - populate(objectMap, "firstName", u.FirstName) - populate(objectMap, "lastName", u.LastName) - populate(objectMap, "phoneNumber", u.PhoneNumber) - populate(objectMap, "preferredContactMethod", u.PreferredContactMethod) - populate(objectMap, "preferredSupportLanguage", u.PreferredSupportLanguage) - populate(objectMap, "preferredTimeZone", u.PreferredTimeZone) - populate(objectMap, "primaryEmailAddress", u.PrimaryEmailAddress) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type UpdateSupportTicket. -func (u UpdateSupportTicket) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contactDetails", u.ContactDetails) - populate(objectMap, "severity", u.Severity) - populate(objectMap, "status", u.Status) - return json.Marshal(objectMap) -} - -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 -}