diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md index ed7207591e39..fb80bff07696 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 2.0.0 (2023-01-20) +### Breaking Changes + +- Type of `SubscriptionUnderManagementGroupProperties.Parent` has been changed from `*DescendantParentGroupInfo` to `*ParentGroupBagInfo` + +### Features Added + +- New struct `ParentGroupBagInfo` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups` 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/managementgroups/armmanagementgroups/zz_generated_api_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/api_client.go similarity index 91% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_api_client.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/api_client.go index bc3e2421dcf0..3e257bc4795a 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_api_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/api_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 armmanagementgroups @@ -27,8 +28,8 @@ type APIClient struct { } // NewAPIClient creates a new instance of APIClient 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 NewAPIClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*APIClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -50,10 +51,11 @@ func NewAPIClient(credential azcore.TokenCredential, options *arm.ClientOptions) // CheckNameAvailability - Checks if the specified management group name is valid and unique // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// checkNameAvailabilityRequest - Management group name availability check parameters. -// options - APIClientCheckNameAvailabilityOptions contains the optional parameters for the APIClient.CheckNameAvailability -// method. +// - checkNameAvailabilityRequest - Management group name availability check parameters. +// - options - APIClientCheckNameAvailabilityOptions contains the optional parameters for the APIClient.CheckNameAvailability +// method. func (client *APIClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *APIClientCheckNameAvailabilityOptions) (APIClientCheckNameAvailabilityResponse, error) { req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityRequest, options) if err != nil { @@ -94,8 +96,9 @@ func (client *APIClient) checkNameAvailabilityHandleResponse(resp *http.Response // StartTenantBackfill - Starts backfilling subscriptions for the Tenant. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// options - APIClientStartTenantBackfillOptions contains the optional parameters for the APIClient.StartTenantBackfill method. +// - options - APIClientStartTenantBackfillOptions contains the optional parameters for the APIClient.StartTenantBackfill method. func (client *APIClient) StartTenantBackfill(ctx context.Context, options *APIClientStartTenantBackfillOptions) (APIClientStartTenantBackfillResponse, error) { req, err := client.startTenantBackfillCreateRequest(ctx, options) if err != nil { @@ -136,9 +139,10 @@ func (client *APIClient) startTenantBackfillHandleResponse(resp *http.Response) // TenantBackfillStatus - Gets tenant backfill status // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// options - APIClientTenantBackfillStatusOptions contains the optional parameters for the APIClient.TenantBackfillStatus -// method. +// - options - APIClientTenantBackfillStatusOptions contains the optional parameters for the APIClient.TenantBackfillStatus +// method. func (client *APIClient) TenantBackfillStatus(ctx context.Context, options *APIClientTenantBackfillStatusOptions) (APIClientTenantBackfillStatusResponse, error) { req, err := client.tenantBackfillStatusCreateRequest(ctx, options) if err != nil { diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md index 40e63121a0c4..ac2c44e9fd93 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/managementgroups/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/managementgroups/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/managementgroups/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/managementgroups/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/client.go similarity index 92% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_client.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/client.go index 5cfe7e66ecbb..f9ce0033d5a2 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/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 armmanagementgroups @@ -31,8 +32,8 @@ type Client struct { } // NewClient creates a new instance of Client 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 NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { if options == nil { options = &arm.ClientOptions{} @@ -55,10 +56,11 @@ func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (* // BeginCreateOrUpdate - Create or update a management group. If a management group is already created and a subsequent create // request is issued with different properties, the management group properties will be updated. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// createManagementGroupRequest - Management group creation parameters. -// options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. +// - groupID - Management Group ID. +// - createManagementGroupRequest - Management group creation parameters. +// - options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. func (client *Client) BeginCreateOrUpdate(ctx context.Context, groupID string, createManagementGroupRequest CreateManagementGroupRequest, options *ClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, groupID, createManagementGroupRequest, options) @@ -76,6 +78,7 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, groupID string, c // CreateOrUpdate - Create or update a management group. If a management group is already created and a subsequent create // request is issued with different properties, the management group properties will be updated. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 func (client *Client) createOrUpdate(ctx context.Context, groupID string, createManagementGroupRequest CreateManagementGroupRequest, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, groupID, createManagementGroupRequest, options) @@ -115,9 +118,10 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, groupID s // BeginDelete - Delete management group. If a management group contains child resources, the request will fail. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. +// - groupID - Management Group ID. +// - options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. func (client *Client) BeginDelete(ctx context.Context, groupID string, options *ClientBeginDeleteOptions) (*runtime.Poller[ClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, groupID, options) @@ -134,6 +138,7 @@ func (client *Client) BeginDelete(ctx context.Context, groupID string, options * // Delete - Delete management group. If a management group contains child resources, the request will fail. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 func (client *Client) deleteOperation(ctx context.Context, groupID string, options *ClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, groupID, options) @@ -173,9 +178,10 @@ func (client *Client) deleteCreateRequest(ctx context.Context, groupID string, o // Get - Get the details of the management group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// options - ClientGetOptions contains the optional parameters for the Client.Get method. +// - groupID - Management Group ID. +// - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, groupID string, options *ClientGetOptions) (ClientGetResponse, error) { req, err := client.getCreateRequest(ctx, groupID, options) if err != nil { @@ -231,10 +237,10 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, } // NewGetDescendantsPager - List all entities that descend from a management group. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// options - ClientGetDescendantsOptions contains the optional parameters for the Client.GetDescendants method. +// - groupID - Management Group ID. +// - options - ClientGetDescendantsOptions contains the optional parameters for the Client.NewGetDescendantsPager method. func (client *Client) NewGetDescendantsPager(groupID string, options *ClientGetDescendantsOptions) *runtime.Pager[ClientGetDescendantsResponse] { return runtime.NewPager(runtime.PagingHandler[ClientGetDescendantsResponse]{ More: func(page ClientGetDescendantsResponse) bool { @@ -297,9 +303,9 @@ func (client *Client) getDescendantsHandleResponse(resp *http.Response) (ClientG } // NewListPager - List management groups for the authenticated user. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// options - ClientListOptions contains the optional parameters for the Client.List method. +// - options - ClientListOptions contains the optional parameters for the Client.NewListPager method. func (client *Client) NewListPager(options *ClientListOptions) *runtime.Pager[ClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListResponse]{ More: func(page ClientListResponse) bool { @@ -359,10 +365,11 @@ func (client *Client) listHandleResponse(resp *http.Response) (ClientListRespons // Update - Update a management group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// patchGroupRequest - Management group patch parameters. -// options - ClientUpdateOptions contains the optional parameters for the Client.Update method. +// - groupID - Management Group ID. +// - patchGroupRequest - Management group patch parameters. +// - options - ClientUpdateOptions contains the optional parameters for the Client.Update method. func (client *Client) Update(ctx context.Context, groupID string, patchGroupRequest PatchManagementGroupRequest, options *ClientUpdateOptions) (ClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, groupID, patchGroupRequest, options) if err != nil { diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/constants.go similarity index 99% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/constants.go index fad557a63a89..e9375cae2491 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/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 armmanagementgroups const ( moduleName = "armmanagementgroups" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) type EntitySearchType string @@ -90,19 +91,19 @@ func PossibleManagementGroupExpandTypeValues() []ManagementGroupExpandType { type Permissions string const ( - PermissionsDelete Permissions = "delete" - PermissionsEdit Permissions = "edit" PermissionsNoaccess Permissions = "noaccess" PermissionsView Permissions = "view" + PermissionsEdit Permissions = "edit" + PermissionsDelete Permissions = "delete" ) // PossiblePermissionsValues returns the possible values for the Permissions const type. func PossiblePermissionsValues() []Permissions { return []Permissions{ - PermissionsDelete, - PermissionsEdit, PermissionsNoaccess, PermissionsView, + PermissionsEdit, + PermissionsDelete, } } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client.go similarity index 93% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client.go index 6e7a577337b7..bb614f3a4ed3 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_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 armmanagementgroups @@ -28,8 +29,8 @@ type EntitiesClient struct { } // NewEntitiesClient creates a new instance of EntitiesClient 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 NewEntitiesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EntitiesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -50,9 +51,9 @@ func NewEntitiesClient(credential azcore.TokenCredential, options *arm.ClientOpt } // NewListPager - List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// options - EntitiesClientListOptions contains the optional parameters for the EntitiesClient.List method. +// - options - EntitiesClientListOptions contains the optional parameters for the EntitiesClient.NewListPager method. func (client *EntitiesClient) NewListPager(options *EntitiesClientListOptions) *runtime.Pager[EntitiesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[EntitiesClientListResponse]{ More: func(page EntitiesClientListResponse) bool { diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod index 7e4cf7e157b8..f36617cd09a1 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client.go similarity index 90% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client.go index 1c22feeadf6d..bc12f53daa75 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_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 armmanagementgroups @@ -30,8 +31,8 @@ type HierarchySettingsClient struct { } // NewHierarchySettingsClient creates a new instance of HierarchySettingsClient 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 NewHierarchySettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*HierarchySettingsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -53,11 +54,12 @@ func NewHierarchySettingsClient(credential azcore.TokenCredential, options *arm. // CreateOrUpdate - Creates or updates the hierarchy settings defined at the Management Group level. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// createTenantSettingsRequest - Tenant level settings request parameter. -// options - HierarchySettingsClientCreateOrUpdateOptions contains the optional parameters for the HierarchySettingsClient.CreateOrUpdate -// method. +// - groupID - Management Group ID. +// - createTenantSettingsRequest - Tenant level settings request parameter. +// - options - HierarchySettingsClientCreateOrUpdateOptions contains the optional parameters for the HierarchySettingsClient.CreateOrUpdate +// method. func (client *HierarchySettingsClient) CreateOrUpdate(ctx context.Context, groupID string, createTenantSettingsRequest CreateOrUpdateSettingsRequest, options *HierarchySettingsClientCreateOrUpdateOptions) (HierarchySettingsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, groupID, createTenantSettingsRequest, options) if err != nil { @@ -102,10 +104,11 @@ func (client *HierarchySettingsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Deletes the hierarchy settings defined at the Management Group level. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// options - HierarchySettingsClientDeleteOptions contains the optional parameters for the HierarchySettingsClient.Delete -// method. +// - groupID - Management Group ID. +// - options - HierarchySettingsClientDeleteOptions contains the optional parameters for the HierarchySettingsClient.Delete +// method. func (client *HierarchySettingsClient) Delete(ctx context.Context, groupID string, options *HierarchySettingsClientDeleteOptions) (HierarchySettingsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, groupID, options) if err != nil { @@ -142,9 +145,10 @@ func (client *HierarchySettingsClient) deleteCreateRequest(ctx context.Context, // Get - Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root Management // Group of the hierarchy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// options - HierarchySettingsClientGetOptions contains the optional parameters for the HierarchySettingsClient.Get method. +// - groupID - Management Group ID. +// - options - HierarchySettingsClientGetOptions contains the optional parameters for the HierarchySettingsClient.Get method. func (client *HierarchySettingsClient) Get(ctx context.Context, groupID string, options *HierarchySettingsClientGetOptions) (HierarchySettingsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, groupID, options) if err != nil { @@ -190,9 +194,10 @@ func (client *HierarchySettingsClient) getHandleResponse(resp *http.Response) (H // List - Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root Management // Group of the hierarchy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// options - HierarchySettingsClientListOptions contains the optional parameters for the HierarchySettingsClient.List method. +// - groupID - Management Group ID. +// - options - HierarchySettingsClientListOptions contains the optional parameters for the HierarchySettingsClient.List method. func (client *HierarchySettingsClient) List(ctx context.Context, groupID string, options *HierarchySettingsClientListOptions) (HierarchySettingsClientListResponse, error) { req, err := client.listCreateRequest(ctx, groupID, options) if err != nil { @@ -237,11 +242,12 @@ func (client *HierarchySettingsClient) listHandleResponse(resp *http.Response) ( // Update - Updates the hierarchy settings defined at the Management Group level. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// createTenantSettingsRequest - Tenant level settings request parameter. -// options - HierarchySettingsClientUpdateOptions contains the optional parameters for the HierarchySettingsClient.Update -// method. +// - groupID - Management Group ID. +// - createTenantSettingsRequest - Tenant level settings request parameter. +// - options - HierarchySettingsClientUpdateOptions contains the optional parameters for the HierarchySettingsClient.Update +// method. func (client *HierarchySettingsClient) Update(ctx context.Context, groupID string, createTenantSettingsRequest CreateOrUpdateSettingsRequest, options *HierarchySettingsClientUpdateOptions) (HierarchySettingsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, groupID, createTenantSettingsRequest, options) if err != nil { diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client.go similarity index 91% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client.go index 6bbaae03fac3..22b2785c8e62 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_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 armmanagementgroups @@ -30,8 +31,8 @@ type ManagementGroupSubscriptionsClient struct { } // NewManagementGroupSubscriptionsClient creates a new instance of ManagementGroupSubscriptionsClient 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 NewManagementGroupSubscriptionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementGroupSubscriptionsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -53,11 +54,12 @@ func NewManagementGroupSubscriptionsClient(credential azcore.TokenCredential, op // Create - Associates existing subscription with the management group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// subscriptionID - Subscription ID. -// options - ManagementGroupSubscriptionsClientCreateOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Create -// method. +// - groupID - Management Group ID. +// - subscriptionID - Subscription ID. +// - options - ManagementGroupSubscriptionsClientCreateOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Create +// method. func (client *ManagementGroupSubscriptionsClient) Create(ctx context.Context, groupID string, subscriptionID string, options *ManagementGroupSubscriptionsClientCreateOptions) (ManagementGroupSubscriptionsClientCreateResponse, error) { req, err := client.createCreateRequest(ctx, groupID, subscriptionID, options) if err != nil { @@ -109,11 +111,12 @@ func (client *ManagementGroupSubscriptionsClient) createHandleResponse(resp *htt // Delete - De-associates subscription from the management group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// subscriptionID - Subscription ID. -// options - ManagementGroupSubscriptionsClientDeleteOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Delete -// method. +// - groupID - Management Group ID. +// - subscriptionID - Subscription ID. +// - options - ManagementGroupSubscriptionsClientDeleteOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Delete +// method. func (client *ManagementGroupSubscriptionsClient) Delete(ctx context.Context, groupID string, subscriptionID string, options *ManagementGroupSubscriptionsClientDeleteOptions) (ManagementGroupSubscriptionsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, groupID, subscriptionID, options) if err != nil { @@ -156,11 +159,12 @@ func (client *ManagementGroupSubscriptionsClient) deleteCreateRequest(ctx contex // GetSubscription - Retrieves details about given subscription which is associated with the management group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// subscriptionID - Subscription ID. -// options - ManagementGroupSubscriptionsClientGetSubscriptionOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.GetSubscription -// method. +// - groupID - Management Group ID. +// - subscriptionID - Subscription ID. +// - options - ManagementGroupSubscriptionsClientGetSubscriptionOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.GetSubscription +// method. func (client *ManagementGroupSubscriptionsClient) GetSubscription(ctx context.Context, groupID string, subscriptionID string, options *ManagementGroupSubscriptionsClientGetSubscriptionOptions) (ManagementGroupSubscriptionsClientGetSubscriptionResponse, error) { req, err := client.getSubscriptionCreateRequest(ctx, groupID, subscriptionID, options) if err != nil { @@ -212,11 +216,11 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionHandleResponse( // NewGetSubscriptionsUnderManagementGroupPager - Retrieves details about all subscriptions which are associated with the // management group. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-04-01 -// groupID - Management Group ID. -// options - ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions contains the optional parameters -// for the ManagementGroupSubscriptionsClient.GetSubscriptionsUnderManagementGroup method. +// - groupID - Management Group ID. +// - options - ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions contains the optional parameters +// for the ManagementGroupSubscriptionsClient.NewGetSubscriptionsUnderManagementGroupPager method. func (client *ManagementGroupSubscriptionsClient) NewGetSubscriptionsUnderManagementGroupPager(groupID string, options *ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions) *runtime.Pager[ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse]{ More: func(page ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse) bool { diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/models.go similarity index 97% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/models.go index d4e8c9b07924..561f3fc4e062 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/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 armmanagementgroups @@ -85,7 +86,7 @@ type ClientBeginDeleteOptions struct { ResumeToken string } -// ClientGetDescendantsOptions contains the optional parameters for the Client.GetDescendants method. +// ClientGetDescendantsOptions contains the optional parameters for the Client.NewGetDescendantsPager method. type ClientGetDescendantsOptions struct { // Page continuation token is only used if a previous operation returned a partial result. If a previous response contains // a nextLink element, the value of the nextLink element will include a token @@ -110,7 +111,7 @@ type ClientGetOptions struct { Recurse *bool } -// ClientListOptions contains the optional parameters for the Client.List method. +// ClientListOptions contains the optional parameters for the Client.NewListPager method. type ClientListOptions struct { // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. CacheControl *string @@ -259,7 +260,7 @@ type DescendantParentGroupInfo struct { ID *string `json:"id,omitempty"` } -// EntitiesClientListOptions contains the optional parameters for the EntitiesClient.List method. +// EntitiesClientListOptions contains the optional parameters for the EntitiesClient.NewListPager method. type EntitiesClientListOptions struct { // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. CacheControl *string @@ -473,7 +474,7 @@ type HierarchySettingsList struct { Value []*HierarchySettingsInfo `json:"value,omitempty"` // READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string `json:"@nextLink,omitempty" azure:"ro"` } // HierarchySettingsProperties - The generic properties of hierarchy settings. @@ -587,7 +588,7 @@ type ManagementGroupListResult struct { Value []*ManagementGroupInfo `json:"value,omitempty"` // READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string `json:"@nextLink,omitempty" azure:"ro"` } // ManagementGroupPathElement - A path element of a management group ancestors. @@ -636,7 +637,7 @@ type ManagementGroupSubscriptionsClientGetSubscriptionOptions struct { } // ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions contains the optional parameters for the -// ManagementGroupSubscriptionsClient.GetSubscriptionsUnderManagementGroup method. +// ManagementGroupSubscriptionsClient.NewGetSubscriptionsUnderManagementGroupPager method. type ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions struct { // Page continuation token is only used if a previous operation returned a partial result. If a previous response contains // a nextLink element, the value of the nextLink element will include a token @@ -692,11 +693,23 @@ type OperationResults struct { Type *string `json:"type,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 } +// ParentGroupBagInfo - The ID, name and displayName of the parent management group. +type ParentGroupBagInfo struct { + // The friendly name of the parent management group. + DisplayName *string `json:"displayName,omitempty"` + + // The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + ID *string `json:"id,omitempty"` + + // The name of the parent management group. For example, 00000000-0000-0000-0000-000000000000 + Name *string `json:"name,omitempty"` +} + // ParentGroupInfo - (Optional) The ID of the parent management group. type ParentGroupInfo struct { // The friendly name of the parent management group. @@ -738,8 +751,8 @@ type SubscriptionUnderManagementGroupProperties struct { // The friendly name of the subscription. DisplayName *string `json:"displayName,omitempty"` - // The ID of the parent management group. - Parent *DescendantParentGroupInfo `json:"parent,omitempty"` + // The ID, name and displayName of the parent management group. + Parent *ParentGroupBagInfo `json:"parent,omitempty"` // The state of the subscription. State *string `json:"state,omitempty"` diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/models_serde.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/models_serde.go new file mode 100644 index 000000000000..2be82927d36b --- /dev/null +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/models_serde.go @@ -0,0 +1,1656 @@ +//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 armmanagementgroups + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AzureAsyncOperationResults. +func (a AzureAsyncOperationResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "status", a.Status) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAsyncOperationResults. +func (a *AzureAsyncOperationResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + objectMap["type"] = "Microsoft.Management/managementGroups" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityRequest. +func (c *CheckNameAvailabilityRequest) 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 CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) 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 CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) 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 CreateManagementGroupChildInfo. +func (c CreateManagementGroupChildInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "children", c.Children) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateManagementGroupChildInfo. +func (c *CreateManagementGroupChildInfo) 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 "children": + err = unpopulate(val, "Children", &c.Children) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, 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 CreateManagementGroupDetails. +func (c CreateManagementGroupDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "parent", c.Parent) + populate(objectMap, "updatedBy", c.UpdatedBy) + populateTimeRFC3339(objectMap, "updatedTime", c.UpdatedTime) + populate(objectMap, "version", c.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateManagementGroupDetails. +func (c *CreateManagementGroupDetails) 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 "parent": + err = unpopulate(val, "Parent", &c.Parent) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &c.UpdatedBy) + delete(rawMsg, key) + case "updatedTime": + err = unpopulateTimeRFC3339(val, "UpdatedTime", &c.UpdatedTime) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &c.Version) + 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 CreateManagementGroupProperties. +func (c CreateManagementGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "children", c.Children) + populate(objectMap, "details", c.Details) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "tenantId", c.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateManagementGroupProperties. +func (c *CreateManagementGroupProperties) 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 "children": + err = unpopulate(val, "Children", &c.Children) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &c.Details) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &c.TenantID) + 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 CreateManagementGroupRequest. +func (c CreateManagementGroupRequest) 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 CreateManagementGroupRequest. +func (c *CreateManagementGroupRequest) 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 CreateOrUpdateSettingsProperties. +func (c CreateOrUpdateSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultManagementGroup", c.DefaultManagementGroup) + populate(objectMap, "requireAuthorizationForGroupCreation", c.RequireAuthorizationForGroupCreation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateOrUpdateSettingsProperties. +func (c *CreateOrUpdateSettingsProperties) 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 "defaultManagementGroup": + err = unpopulate(val, "DefaultManagementGroup", &c.DefaultManagementGroup) + delete(rawMsg, key) + case "requireAuthorizationForGroupCreation": + err = unpopulate(val, "RequireAuthorizationForGroupCreation", &c.RequireAuthorizationForGroupCreation) + 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 CreateOrUpdateSettingsRequest. +func (c CreateOrUpdateSettingsRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateOrUpdateSettingsRequest. +func (c *CreateOrUpdateSettingsRequest) 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 "properties": + err = unpopulate(val, "Properties", &c.Properties) + 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 CreateParentGroupInfo. +func (c CreateParentGroupInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateParentGroupInfo. +func (c *CreateParentGroupInfo) 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 "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + 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 DescendantInfo. +func (d DescendantInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DescendantInfo. +func (d *DescendantInfo) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DescendantInfoProperties. +func (d DescendantInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "parent", d.Parent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DescendantInfoProperties. +func (d *DescendantInfoProperties) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "parent": + err = unpopulate(val, "Parent", &d.Parent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DescendantListResult. +func (d DescendantListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DescendantListResult. +func (d *DescendantListResult) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DescendantParentGroupInfo. +func (d DescendantParentGroupInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DescendantParentGroupInfo. +func (d *DescendantParentGroupInfo) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityHierarchyItem. +func (e EntityHierarchyItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityHierarchyItem. +func (e *EntityHierarchyItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityHierarchyItemProperties. +func (e EntityHierarchyItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "children", e.Children) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "permissions", e.Permissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityHierarchyItemProperties. +func (e *EntityHierarchyItemProperties) 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 "children": + err = unpopulate(val, "Children", &e.Children) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &e.Permissions) + 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 EntityInfo. +func (e EntityInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityInfo. +func (e *EntityInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityInfoProperties. +func (e EntityInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "inheritedPermissions", e.InheritedPermissions) + populate(objectMap, "numberOfChildGroups", e.NumberOfChildGroups) + populate(objectMap, "numberOfChildren", e.NumberOfChildren) + populate(objectMap, "numberOfDescendants", e.NumberOfDescendants) + populate(objectMap, "parent", e.Parent) + populate(objectMap, "parentDisplayNameChain", e.ParentDisplayNameChain) + populate(objectMap, "parentNameChain", e.ParentNameChain) + populate(objectMap, "permissions", e.Permissions) + populate(objectMap, "tenantId", e.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityInfoProperties. +func (e *EntityInfoProperties) 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 "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "inheritedPermissions": + err = unpopulate(val, "InheritedPermissions", &e.InheritedPermissions) + delete(rawMsg, key) + case "numberOfChildGroups": + err = unpopulate(val, "NumberOfChildGroups", &e.NumberOfChildGroups) + delete(rawMsg, key) + case "numberOfChildren": + err = unpopulate(val, "NumberOfChildren", &e.NumberOfChildren) + delete(rawMsg, key) + case "numberOfDescendants": + err = unpopulate(val, "NumberOfDescendants", &e.NumberOfDescendants) + delete(rawMsg, key) + case "parent": + err = unpopulate(val, "Parent", &e.Parent) + delete(rawMsg, key) + case "parentDisplayNameChain": + err = unpopulate(val, "ParentDisplayNameChain", &e.ParentDisplayNameChain) + delete(rawMsg, key) + case "parentNameChain": + err = unpopulate(val, "ParentNameChain", &e.ParentNameChain) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &e.Permissions) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &e.TenantID) + 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 EntityListResult. +func (e EntityListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", e.Count) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityListResult. +func (e *EntityListResult) 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 "count": + err = unpopulate(val, "Count", &e.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityParentGroupInfo. +func (e EntityParentGroupInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityParentGroupInfo. +func (e *EntityParentGroupInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) 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 ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "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 HierarchySettings. +func (h HierarchySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HierarchySettings. +func (h *HierarchySettings) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HierarchySettingsInfo. +func (h HierarchySettingsInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HierarchySettingsInfo. +func (h *HierarchySettingsInfo) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HierarchySettingsList. +func (h HierarchySettingsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "@nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HierarchySettingsList. +func (h *HierarchySettingsList) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "@nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HierarchySettingsProperties. +func (h HierarchySettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultManagementGroup", h.DefaultManagementGroup) + populate(objectMap, "requireAuthorizationForGroupCreation", h.RequireAuthorizationForGroupCreation) + populate(objectMap, "tenantId", h.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HierarchySettingsProperties. +func (h *HierarchySettingsProperties) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultManagementGroup": + err = unpopulate(val, "DefaultManagementGroup", &h.DefaultManagementGroup) + delete(rawMsg, key) + case "requireAuthorizationForGroupCreation": + err = unpopulate(val, "RequireAuthorizationForGroupCreation", &h.RequireAuthorizationForGroupCreation) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &h.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListSubscriptionUnderManagementGroup. +func (l ListSubscriptionUnderManagementGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListSubscriptionUnderManagementGroup. +func (l *ListSubscriptionUnderManagementGroup) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroup. +func (m ManagementGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroup. +func (m *ManagementGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupChildInfo. +func (m ManagementGroupChildInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "children", m.Children) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupChildInfo. +func (m *ManagementGroupChildInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "children": + err = unpopulate(val, "Children", &m.Children) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupDetails. +func (m ManagementGroupDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "managementGroupAncestors", m.ManagementGroupAncestors) + populate(objectMap, "managementGroupAncestorsChain", m.ManagementGroupAncestorsChain) + populate(objectMap, "parent", m.Parent) + populate(objectMap, "path", m.Path) + populate(objectMap, "updatedBy", m.UpdatedBy) + populateTimeRFC3339(objectMap, "updatedTime", m.UpdatedTime) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupDetails. +func (m *ManagementGroupDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "managementGroupAncestors": + err = unpopulate(val, "ManagementGroupAncestors", &m.ManagementGroupAncestors) + delete(rawMsg, key) + case "managementGroupAncestorsChain": + err = unpopulate(val, "ManagementGroupAncestorsChain", &m.ManagementGroupAncestorsChain) + delete(rawMsg, key) + case "parent": + err = unpopulate(val, "Parent", &m.Parent) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &m.Path) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &m.UpdatedBy) + delete(rawMsg, key) + case "updatedTime": + err = unpopulateTimeRFC3339(val, "UpdatedTime", &m.UpdatedTime) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupInfo. +func (m ManagementGroupInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupInfo. +func (m *ManagementGroupInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupInfoProperties. +func (m ManagementGroupInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupInfoProperties. +func (m *ManagementGroupInfoProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupListResult. +func (m ManagementGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "@nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupListResult. +func (m *ManagementGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "@nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupPathElement. +func (m ManagementGroupPathElement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "name", m.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupPathElement. +func (m *ManagementGroupPathElement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementGroupProperties. +func (m ManagementGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "children", m.Children) + populate(objectMap, "details", m.Details) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupProperties. +func (m *ManagementGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "children": + err = unpopulate(val, "Children", &m.Children) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &m.Details) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, 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 OperationDisplayProperties. +func (o OperationDisplayProperties) 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 OperationDisplayProperties. +func (o *OperationDisplayProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, 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 OperationResults. +func (o OperationResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResults. +func (o *OperationResults) 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 "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + 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 ParentGroupBagInfo. +func (p ParentGroupBagInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ParentGroupBagInfo. +func (p *ParentGroupBagInfo) 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) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + 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 ParentGroupInfo. +func (p ParentGroupInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ParentGroupInfo. +func (p *ParentGroupInfo) 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) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + 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 PatchManagementGroupRequest. +func (p PatchManagementGroupRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "parentGroupId", p.ParentGroupID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchManagementGroupRequest. +func (p *PatchManagementGroupRequest) 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) + case "parentGroupId": + err = unpopulate(val, "ParentGroupID", &p.ParentGroupID) + 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 SubscriptionUnderManagementGroup. +func (s SubscriptionUnderManagementGroup) 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 SubscriptionUnderManagementGroup. +func (s *SubscriptionUnderManagementGroup) 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 SubscriptionUnderManagementGroupProperties. +func (s SubscriptionUnderManagementGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "parent", s.Parent) + populate(objectMap, "state", s.State) + populate(objectMap, "tenant", s.Tenant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUnderManagementGroupProperties. +func (s *SubscriptionUnderManagementGroupProperties) 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 "parent": + err = unpopulate(val, "Parent", &s.Parent) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "tenant": + err = unpopulate(val, "Tenant", &s.Tenant) + 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 TenantBackfillStatusResult. +func (t TenantBackfillStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", t.Status) + populate(objectMap, "tenantId", t.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TenantBackfillStatusResult. +func (t *TenantBackfillStatusResult) 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 "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &t.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, 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/managementgroups/armmanagementgroups/zz_generated_operations_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client.go similarity index 92% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client.go index b5550bac9b2e..2457897ed591 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/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 armmanagementgroups @@ -27,8 +28,8 @@ type OperationsClient struct { } // 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{} @@ -49,9 +50,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available Management REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-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 { diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/response_types.go similarity index 92% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/response_types.go index 75cf2ff914c7..76ce4e6c8119 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/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 armmanagementgroups @@ -23,17 +24,17 @@ type APIClientTenantBackfillStatusResponse struct { TenantBackfillStatusResult } -// ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate. +// ClientCreateOrUpdateResponse contains the response from method Client.BeginCreateOrUpdate. type ClientCreateOrUpdateResponse struct { ManagementGroup } -// ClientDeleteResponse contains the response from method Client.Delete. +// ClientDeleteResponse contains the response from method Client.BeginDelete. type ClientDeleteResponse struct { AzureAsyncOperationResults } -// ClientGetDescendantsResponse contains the response from method Client.GetDescendants. +// ClientGetDescendantsResponse contains the response from method Client.NewGetDescendantsPager. type ClientGetDescendantsResponse struct { DescendantListResult } @@ -43,7 +44,7 @@ type ClientGetResponse struct { ManagementGroup } -// ClientListResponse contains the response from method Client.List. +// ClientListResponse contains the response from method Client.NewListPager. type ClientListResponse struct { ManagementGroupListResult } @@ -53,7 +54,7 @@ type ClientUpdateResponse struct { ManagementGroup } -// EntitiesClientListResponse contains the response from method EntitiesClient.List. +// EntitiesClientListResponse contains the response from method EntitiesClient.NewListPager. type EntitiesClientListResponse struct { EntityListResult } @@ -98,12 +99,12 @@ type ManagementGroupSubscriptionsClientGetSubscriptionResponse struct { SubscriptionUnderManagementGroup } -// ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse contains the response from method ManagementGroupSubscriptionsClient.GetSubscriptionsUnderManagementGroup. +// ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse contains the response from method ManagementGroupSubscriptionsClient.NewGetSubscriptionsUnderManagementGroupPager. type ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse struct { ListSubscriptionUnderManagementGroup } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/managementgroups/armmanagementgroups/time_rfc3339.go index 49470d362d5e..894b939958eb 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/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 armmanagementgroups @@ -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/managementgroups/armmanagementgroups/ze_generated_example_entities_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_entities_client_test.go deleted file mode 100644 index 3b0f0c0349e2..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_entities_client_test.go +++ /dev/null @@ -1,50 +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 armmanagementgroups_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetEntities.json -func ExampleEntitiesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewEntitiesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armmanagementgroups.EntitiesClientListOptions{Skiptoken: nil, - Skip: nil, - Top: nil, - Select: nil, - Search: nil, - Filter: nil, - View: nil, - GroupName: nil, - CacheControl: 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/managementgroups/armmanagementgroups/ze_generated_example_hierarchysettings_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_hierarchysettings_client_test.go deleted file mode 100644 index 3aafe1ac054c..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_hierarchysettings_client_test.go +++ /dev/null @@ -1,133 +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 armmanagementgroups_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/managementgroups/armmanagementgroups" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListHierarchySettings.json -func ExampleHierarchySettingsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "root", - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetHierarchySettings.json -func ExampleHierarchySettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "root", - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutHierarchySettings.json -func ExampleHierarchySettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "root", - armmanagementgroups.CreateOrUpdateSettingsRequest{ - Properties: &armmanagementgroups.CreateOrUpdateSettingsProperties{ - DefaultManagementGroup: to.Ptr("/providers/Microsoft.Management/managementGroups/DefaultGroup"), - RequireAuthorizationForGroupCreation: to.Ptr(true), - }, - }, - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchHierarchySettings.json -func ExampleHierarchySettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "root", - armmanagementgroups.CreateOrUpdateSettingsRequest{ - Properties: &armmanagementgroups.CreateOrUpdateSettingsProperties{ - DefaultManagementGroup: to.Ptr("/providers/Microsoft.Management/managementGroups/DefaultGroup"), - RequireAuthorizationForGroupCreation: to.Ptr(true), - }, - }, - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteHierarchySettings.json -func ExampleHierarchySettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewHierarchySettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "root", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroups_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroups_client_test.go deleted file mode 100644 index e1788daedb2c..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroups_client_test.go +++ /dev/null @@ -1,179 +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 armmanagementgroups_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/managementgroups/armmanagementgroups" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListManagementGroups.json -func ExampleClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armmanagementgroups.ClientListOptions{CacheControl: to.Ptr("no-cache"), - Skiptoken: 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroup.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "20000000-0001-0000-0000-000000000000", - &armmanagementgroups.ClientGetOptions{Expand: nil, - Recurse: nil, - Filter: nil, - CacheControl: to.Ptr("no-cache"), - }) - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutManagementGroup.json -func ExampleClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "ChildGroup", - armmanagementgroups.CreateManagementGroupRequest{ - Properties: &armmanagementgroups.CreateManagementGroupProperties{ - DisplayName: to.Ptr("ChildGroup"), - Details: &armmanagementgroups.CreateManagementGroupDetails{ - Parent: &armmanagementgroups.CreateParentGroupInfo{ - ID: to.Ptr("/providers/Microsoft.Management/managementGroups/RootGroup"), - }, - }, - }, - }, - &armmanagementgroups.ClientBeginCreateOrUpdateOptions{CacheControl: to.Ptr("no-cache")}) - 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 -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchManagementGroup.json -func ExampleClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "ChildGroup", - armmanagementgroups.PatchManagementGroupRequest{ - DisplayName: to.Ptr("AlternateDisplayName"), - ParentGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/AlternateRootGroup"), - }, - &armmanagementgroups.ClientUpdateOptions{CacheControl: to.Ptr("no-cache")}) - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteManagementGroup.json -func ExampleClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "GroupToDelete", - &armmanagementgroups.ClientBeginDeleteOptions{CacheControl: to.Ptr("no-cache")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetDescendants.json -func ExampleClient_NewGetDescendantsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetDescendantsPager("20000000-0000-0000-0000-000000000000", - &armmanagementgroups.ClientGetDescendantsOptions{Skiptoken: nil, - Top: 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/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsapi_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsapi_client_test.go deleted file mode 100644 index 7a9f59f90f5d..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsapi_client_test.go +++ /dev/null @@ -1,82 +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 armmanagementgroups_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/managementgroups/armmanagementgroups" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/CheckManagementGroupNameAvailability.json -func ExampleAPIClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewAPIClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - armmanagementgroups.CheckNameAvailabilityRequest{ - Name: to.Ptr("nameTocheck"), - Type: to.Ptr("Microsoft.Management/managementGroups"), - }, - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/StartTenantBackfillRequest.json -func ExampleAPIClient_StartTenantBackfill() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewAPIClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.StartTenantBackfill(ctx, - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/TenantBackfillStatusRequest.json -func ExampleAPIClient_TenantBackfillStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewAPIClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.TenantBackfillStatus(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsubscriptions_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsubscriptions_client_test.go deleted file mode 100644 index 1a9b565f7a58..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_managementgroupsubscriptions_client_test.go +++ /dev/null @@ -1,107 +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 armmanagementgroups_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/managementgroups/armmanagementgroups" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/AddManagementGroupSubscription.json -func ExampleManagementGroupSubscriptionsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "Group", - "728bcbe4-8d56-4510-86c2-4921b8beefbc", - &armmanagementgroups.ManagementGroupSubscriptionsClientCreateOptions{CacheControl: to.Ptr("no-cache")}) - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/RemoveManagementGroupSubscription.json -func ExampleManagementGroupSubscriptionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "Group", - "728bcbe4-8d56-4510-86c2-4921b8beefbc", - &armmanagementgroups.ManagementGroupSubscriptionsClientDeleteOptions{CacheControl: to.Ptr("no-cache")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetSubscriptionFromManagementGroup.json -func ExampleManagementGroupSubscriptionsClient_GetSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetSubscription(ctx, - "Group", - "728bcbe4-8d56-4510-86c2-4921b8beefbc", - &armmanagementgroups.ManagementGroupSubscriptionsClientGetSubscriptionOptions{CacheControl: to.Ptr("no-cache")}) - 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/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetAllSubscriptionsFromManagementGroup.json -func ExampleManagementGroupSubscriptionsClient_NewGetSubscriptionsUnderManagementGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmanagementgroups.NewManagementGroupSubscriptionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetSubscriptionsUnderManagementGroupPager("Group", - &armmanagementgroups.ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions{Skiptoken: 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/managementgroups/armmanagementgroups/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/ze_generated_example_operations_client_test.go deleted file mode 100644 index 2de658c4ed98..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/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 armmanagementgroups_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-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 := armmanagementgroups.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/managementgroups/armmanagementgroups/zz_generated_models_serde.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models_serde.go deleted file mode 100644 index 834b9c59e10d..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models_serde.go +++ /dev/null @@ -1,149 +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 armmanagementgroups - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type CreateManagementGroupChildInfo. -func (c CreateManagementGroupChildInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "children", c.Children) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CreateManagementGroupDetails. -func (c CreateManagementGroupDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "parent", c.Parent) - populate(objectMap, "updatedBy", c.UpdatedBy) - populateTimeRFC3339(objectMap, "updatedTime", c.UpdatedTime) - populate(objectMap, "version", c.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CreateManagementGroupDetails. -func (c *CreateManagementGroupDetails) 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 "parent": - err = unpopulate(val, "Parent", &c.Parent) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, "UpdatedBy", &c.UpdatedBy) - delete(rawMsg, key) - case "updatedTime": - err = unpopulateTimeRFC3339(val, "UpdatedTime", &c.UpdatedTime) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &c.Version) - 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 CreateManagementGroupProperties. -func (c CreateManagementGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "children", c.Children) - populate(objectMap, "details", c.Details) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "tenantId", c.TenantID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CreateOrUpdateSettingsRequest. -func (c CreateOrUpdateSettingsRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupDetails. -func (m *ManagementGroupDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "managementGroupAncestors": - err = unpopulate(val, "ManagementGroupAncestors", &m.ManagementGroupAncestors) - delete(rawMsg, key) - case "managementGroupAncestorsChain": - err = unpopulate(val, "ManagementGroupAncestorsChain", &m.ManagementGroupAncestorsChain) - delete(rawMsg, key) - case "parent": - err = unpopulate(val, "Parent", &m.Parent) - delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &m.Path) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, "UpdatedBy", &m.UpdatedBy) - delete(rawMsg, key) - case "updatedTime": - err = unpopulateTimeRFC3339(val, "UpdatedTime", &m.UpdatedTime) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &m.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PatchManagementGroupRequest. -func (p PatchManagementGroupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "parentGroupId", p.ParentGroupID) - 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 -}