diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md index 45d30f6ec374..cc59ebcea1a3 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.1.1 (2023-07-26) +### Other Changes + + ## 1.1.0 (2023-03-31) ### Features Added diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/api_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/api_client.go index 125bba16dd28..dadc6d6039d9 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/api_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/api_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups @@ -41,23 +40,26 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityRequest, options) if err != nil { return APIClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return APIClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return APIClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return APIClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -68,10 +70,13 @@ func (client *APIClient) checkNameAvailabilityCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) + if err := runtime.MarshalAsJSON(req, checkNameAvailabilityRequest); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -86,21 +91,24 @@ 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 +// Generated from API version 2023-04-01 // - options - APIClientStartTenantBackfillOptions contains the optional parameters for the APIClient.StartTenantBackfill method. func (client *APIClient) StartTenantBackfill(ctx context.Context, options *APIClientStartTenantBackfillOptions) (APIClientStartTenantBackfillResponse, error) { + var err error req, err := client.startTenantBackfillCreateRequest(ctx, options) if err != nil { return APIClientStartTenantBackfillResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return APIClientStartTenantBackfillResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return APIClientStartTenantBackfillResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return APIClientStartTenantBackfillResponse{}, err } - return client.startTenantBackfillHandleResponse(resp) + resp, err := client.startTenantBackfillHandleResponse(httpResp) + return resp, err } // startTenantBackfillCreateRequest creates the StartTenantBackfill request. @@ -111,7 +119,7 @@ func (client *APIClient) startTenantBackfillCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -129,22 +137,25 @@ 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 +// Generated from API version 2023-04-01 // - options - APIClientTenantBackfillStatusOptions contains the optional parameters for the APIClient.TenantBackfillStatus // method. func (client *APIClient) TenantBackfillStatus(ctx context.Context, options *APIClientTenantBackfillStatusOptions) (APIClientTenantBackfillStatusResponse, error) { + var err error req, err := client.tenantBackfillStatusCreateRequest(ctx, options) if err != nil { return APIClientTenantBackfillStatusResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return APIClientTenantBackfillStatusResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return APIClientTenantBackfillStatusResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return APIClientTenantBackfillStatusResponse{}, err } - return client.tenantBackfillStatusHandleResponse(resp) + resp, err := client.tenantBackfillStatusHandleResponse(httpResp) + return resp, err } // tenantBackfillStatusCreateRequest creates the TenantBackfillStatus request. @@ -155,7 +166,7 @@ func (client *APIClient) tenantBackfillStatusCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/api_client_example_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/api_client_example_test.go deleted file mode 100644 index 937244b7d7c0..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/api_client_example_test.go +++ /dev/null @@ -1,95 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResult = armmanagementgroups.CheckNameAvailabilityResult{ - // Message: to.Ptr("Error message"), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armmanagementgroups.ReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIClient().StartTenantBackfill(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantBackfillStatusResult = armmanagementgroups.TenantBackfillStatusResult{ - // Status: to.Ptr(armmanagementgroups.StatusStarted), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIClient().TenantBackfillStatus(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantBackfillStatusResult = armmanagementgroups.TenantBackfillStatusResult{ - // Status: to.Ptr(armmanagementgroups.StatusStarted), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // } -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md index 8ebb44117511..ac13ccc70d5a 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.1.0 +module-version: 1.1.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/client.go index 5483ba9df2a0..eb6cb3c1f20e 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups @@ -46,7 +45,7 @@ func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (* // 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 +// Generated from API version 2023-04-01 // - groupID - Management Group ID. // - createManagementGroupRequest - Management group creation parameters. // - options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. @@ -56,9 +55,10 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, groupID string, c if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, groupID string, c // 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 +// Generated from API version 2023-04-01 func (client *Client) createOrUpdate(ctx context.Context, groupID string, createManagementGroupRequest CreateManagementGroupRequest, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, groupID, createManagementGroupRequest, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -96,19 +98,22 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, groupID s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.CacheControl != nil { req.Raw().Header["Cache-Control"] = []string{*options.CacheControl} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createManagementGroupRequest) + if err := runtime.MarshalAsJSON(req, createManagementGroupRequest); err != nil { + return nil, err + } + return req, nil } // 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 +// Generated from API version 2023-04-01 // - 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) { @@ -117,9 +122,10 @@ func (client *Client) BeginDelete(ctx context.Context, groupID string, options * if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -128,20 +134,22 @@ 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 +// Generated from API version 2023-04-01 func (client *Client) deleteOperation(ctx context.Context, groupID string, options *ClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, groupID, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -156,7 +164,7 @@ func (client *Client) deleteCreateRequest(ctx context.Context, groupID string, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.CacheControl != nil { req.Raw().Header["Cache-Control"] = []string{*options.CacheControl} @@ -168,22 +176,25 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.getCreateRequest(ctx, groupID, options) if err != nil { return ClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -198,7 +209,7 @@ func (client *Client) getCreateRequest(ctx context.Context, groupID string, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -227,7 +238,7 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // NewGetDescendantsPager - List all entities that descend from a management group. // -// Generated from API version 2021-04-01 +// Generated from API version 2023-04-01 // - 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] { @@ -270,7 +281,7 @@ func (client *Client) getDescendantsCreateRequest(ctx context.Context, groupID s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } @@ -293,7 +304,7 @@ func (client *Client) getDescendantsHandleResponse(resp *http.Response) (ClientG // NewListPager - List management groups for the authenticated user. // -// Generated from API version 2021-04-01 +// Generated from API version 2023-04-01 // - 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]{ @@ -331,7 +342,7 @@ func (client *Client) listCreateRequest(ctx context.Context, options *ClientList return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } @@ -355,23 +366,26 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.updateCreateRequest(ctx, groupID, patchGroupRequest, options) if err != nil { return ClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -386,13 +400,16 @@ func (client *Client) updateCreateRequest(ctx context.Context, groupID string, p return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.CacheControl != nil { req.Raw().Header["Cache-Control"] = []string{*options.CacheControl} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, patchGroupRequest) + if err := runtime.MarshalAsJSON(req, patchGroupRequest); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/client_example_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/client_example_test.go deleted file mode 100644 index 064303dc55bd..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/client_example_test.go +++ /dev/null @@ -1,525 +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. -// DO NOT EDIT. - -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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListPager(&armmanagementgroups.ClientListOptions{CacheControl: to.Ptr("no-cache"), - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagementGroupListResult = armmanagementgroups.ManagementGroupListResult{ - // Value: []*armmanagementgroups.ManagementGroupInfo{ - // { - // Name: to.Ptr("20000000-0001-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), - // Properties: &armmanagementgroups.ManagementGroupInfoProperties{ - // DisplayName: to.Ptr("Group 1 Tenant 2"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("20000000-0004-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0004-0000-0000-000000000000"), - // Properties: &armmanagementgroups.ManagementGroupInfoProperties{ - // DisplayName: to.Ptr("Group 4 Tenant 2"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroup.json -func ExampleClient_Get_getManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagementGroup = armmanagementgroups.ManagementGroup{ - // Name: to.Ptr("20000000-0001-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), - // Properties: &armmanagementgroups.ManagementGroupProperties{ - // DisplayName: to.Ptr("Group 1 Tenant 2"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Details: &armmanagementgroups.ManagementGroupDetails{ - // Parent: &armmanagementgroups.ParentGroupInfo{ - // Name: to.Ptr("RootGroup"), - // DisplayName: to.Ptr("RootGroup"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/RootGroup"), - // }, - // UpdatedBy: to.Ptr("16b8ef21-5c9f-420c-bcc9-e4f8c9f30b4b"), - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.00Z"); return t}()), - // Version: to.Ptr[int32](1), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithAncestors.json -func ExampleClient_Get_getManagementGroupWithAncestors() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "20000000-0001-0000-0000-00000000000", &armmanagementgroups.ClientGetOptions{Expand: to.Ptr(armmanagementgroups.ManagementGroupExpandTypeAncestors), - Recurse: nil, - Filter: nil, - CacheControl: to.Ptr("no-cache"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagementGroup = armmanagementgroups.ManagementGroup{ - // Name: to.Ptr("20000000-0001-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), - // Properties: &armmanagementgroups.ManagementGroupProperties{ - // DisplayName: to.Ptr("Group 1 Tenant 2"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Details: &armmanagementgroups.ManagementGroupDetails{ - // ManagementGroupAncestorsChain: []*armmanagementgroups.ManagementGroupPathElement{ - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000001"), - // DisplayName: to.Ptr("Parent display name"), - // }, - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("Grandparent display name"), - // }}, - // Parent: &armmanagementgroups.ParentGroupInfo{ - // Name: to.Ptr("20000000-0000-0000-0000-000000000001"), - // DisplayName: to.Ptr("Parent display name"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000001"), - // }, - // UpdatedBy: to.Ptr("Test"), - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.00Z"); return t}()), - // Version: to.Ptr[int32](1), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithExpand.json -func ExampleClient_Get_getManagementGroupWithExpand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "20000000-0001-0000-0000-000000000000", &armmanagementgroups.ClientGetOptions{Expand: to.Ptr(armmanagementgroups.ManagementGroupExpandTypeChildren), - Recurse: nil, - Filter: nil, - CacheControl: to.Ptr("no-cache"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagementGroup = armmanagementgroups.ManagementGroup{ - // Name: to.Ptr("20000000-0001-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), - // Properties: &armmanagementgroups.ManagementGroupProperties{ - // Children: []*armmanagementgroups.ManagementGroupChildInfo{ - // { - // Name: to.Ptr("20000000-0002-0000-0000-000000000000"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeMicrosoftManagementManagementGroups), - // DisplayName: to.Ptr("Group 2 Tenant 2"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0002-0000-0000-000000000000"), - // }, - // { - // Name: to.Ptr("20000000-0003-0000-0000-000000000000"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeMicrosoftManagementManagementGroups), - // DisplayName: to.Ptr("Group 3 Tenant 2"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0003-0000-0000-000000000000"), - // }, - // { - // Name: to.Ptr("10000000-F004-0000-0000-000000000000"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeSubscriptions), - // DisplayName: to.Ptr("Subscription 4 Tenant 1"), - // ID: to.Ptr("/subscriptions/10000000-F004-0000-0000-000000000000"), - // }, - // { - // Name: to.Ptr("20000000-F005-0000-0000-000000000000"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeSubscriptions), - // DisplayName: to.Ptr("Subscription 5 Tenant 2"), - // ID: to.Ptr("/subscriptions/20000000-F005-0000-0000-000000000000"), - // }, - // { - // Name: to.Ptr("30000000-F003-0000-0000-000000000000"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeSubscriptions), - // DisplayName: to.Ptr("Subscription 3 Tenant 3"), - // ID: to.Ptr("/subscriptions/30000000-F003-0000-0000-000000000000"), - // }}, - // DisplayName: to.Ptr("Group 1 Tenant 2"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Details: &armmanagementgroups.ManagementGroupDetails{ - // Parent: &armmanagementgroups.ParentGroupInfo{ - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("20000000-0000-0000-0000-000000000000"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000"), - // }, - // UpdatedBy: to.Ptr("Test"), - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.00Z"); return t}()), - // Version: to.Ptr[int32](1), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithPath.json -func ExampleClient_Get_getManagementGroupWithPath() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "20000000-0001-0000-0000-000000000000", &armmanagementgroups.ClientGetOptions{Expand: to.Ptr(armmanagementgroups.ManagementGroupExpandTypePath), - Recurse: nil, - Filter: nil, - CacheControl: to.Ptr("no-cache"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagementGroup = armmanagementgroups.ManagementGroup{ - // Name: to.Ptr("20000000-0001-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), - // Properties: &armmanagementgroups.ManagementGroupProperties{ - // DisplayName: to.Ptr("Group 1 Tenant 2"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Details: &armmanagementgroups.ManagementGroupDetails{ - // Path: []*armmanagementgroups.ManagementGroupPathElement{ - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("Grandparent display name"), - // }, - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000001"), - // DisplayName: to.Ptr("Parent display name"), - // }}, - // Parent: &armmanagementgroups.ParentGroupInfo{ - // Name: to.Ptr("20000000-0000-0000-0000-000000000001"), - // DisplayName: to.Ptr("Parent display name"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000001"), - // }, - // UpdatedBy: to.Ptr("Test"), - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.00Z"); return t}()), - // Version: to.Ptr[int32](1), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithExpandAndRecurse.json -func ExampleClient_Get_getManagementGroupsWithExpandAndRecurse() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "20000000-0001-0000-0000-000000000000", &armmanagementgroups.ClientGetOptions{Expand: to.Ptr(armmanagementgroups.ManagementGroupExpandTypeChildren), - Recurse: to.Ptr(true), - Filter: nil, - CacheControl: to.Ptr("no-cache"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagementGroup = armmanagementgroups.ManagementGroup{ - // Name: to.Ptr("RootGroup"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/RootGroup"), - // Properties: &armmanagementgroups.ManagementGroupProperties{ - // Children: []*armmanagementgroups.ManagementGroupChildInfo{ - // { - // Name: to.Ptr("Child"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeMicrosoftManagementManagementGroups), - // Children: []*armmanagementgroups.ManagementGroupChildInfo{ - // { - // Name: to.Ptr("Leaf"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeMicrosoftManagementManagementGroups), - // Children: []*armmanagementgroups.ManagementGroupChildInfo{ - // { - // Name: to.Ptr("728bcbe4-8d56-4510-86c2-4921b8beefbc"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeSubscriptions), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/728bcbe4-8d56-4510-86c2-4921b8beefbc"), - // }}, - // DisplayName: to.Ptr("Leaf"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/Leaf"), - // }}, - // DisplayName: to.Ptr("Child"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/Child"), - // }, - // { - // Name: to.Ptr("AnotherChild"), - // Type: to.Ptr(armmanagementgroups.ManagementGroupChildTypeMicrosoftManagementManagementGroups), - // DisplayName: to.Ptr("Leaf"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/AnotherChild"), - // }}, - // DisplayName: to.Ptr("RootGroup"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Details: &armmanagementgroups.ManagementGroupDetails{ - // Parent: &armmanagementgroups.ParentGroupInfo{ - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("20000000-0000-0000-0000-000000000000"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000"), - // }, - // UpdatedBy: to.Ptr("bd490e30-04cb-433e-b8c8-6066959a8bab"), - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T02:26:49.0022093Z"); return t}()), - // Version: to.Ptr[int32](2), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagementGroup = armmanagementgroups.ManagementGroup{ - // Name: to.Ptr("ChildGroup"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ChildGroup"), - // Properties: &armmanagementgroups.ManagementGroupProperties{ - // DisplayName: to.Ptr("ChildGroup"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Details: &armmanagementgroups.ManagementGroupDetails{ - // Parent: &armmanagementgroups.ParentGroupInfo{ - // Name: to.Ptr("RootGroup"), - // DisplayName: to.Ptr("RootGroup"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/RootGroup"), - // }, - // UpdatedBy: to.Ptr("16b8ef21-5c9f-420c-bcc9-e4f8c9f30b4b"), - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.00Z"); return t}()), - // Version: to.Ptr[int32](1), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagementGroup = armmanagementgroups.ManagementGroup{ - // Name: to.Ptr("ChildGroup"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ChildGroup"), - // Properties: &armmanagementgroups.ManagementGroupProperties{ - // DisplayName: to.Ptr("AlternateDisplayName"), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Details: &armmanagementgroups.ManagementGroupDetails{ - // Parent: &armmanagementgroups.ParentGroupInfo{ - // Name: to.Ptr("AlternateRootGroup"), - // DisplayName: to.Ptr("AlternateRootGroup"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/AlternateRootGroup"), - // }, - // UpdatedBy: to.Ptr("bd490e30-04cb-433e-b8c8-6066959a8bab"), - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T02:46:59.0545645Z"); return t}()), - // Version: to.Ptr[int32](2), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewGetDescendantsPager("20000000-0000-0000-0000-000000000000", &armmanagementgroups.ClientGetDescendantsOptions{Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DescendantListResult = armmanagementgroups.DescendantListResult{ - // Value: []*armmanagementgroups.DescendantInfo{ - // { - // Name: to.Ptr("20000000-0001-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), - // Properties: &armmanagementgroups.DescendantInfoProperties{ - // DisplayName: to.Ptr("Group 1"), - // Parent: &armmanagementgroups.DescendantParentGroupInfo{ - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // { - // Name: to.Ptr("20000000-0004-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups/subscriptions"), - // ID: to.Ptr("/subscriptions/20000000-0004-0000-0000-000000000000"), - // Properties: &armmanagementgroups.DescendantInfoProperties{ - // DisplayName: to.Ptr("Subscription 4"), - // Parent: &armmanagementgroups.DescendantParentGroupInfo{ - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/client_factory.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/client_factory.go index 3786c5ed8872..7cc65748e66a 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/client_factory.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/client_factory.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups @@ -36,13 +35,18 @@ func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOpti }, nil } +func (c *ClientFactory) NewAPIClient() *APIClient { + subClient, _ := NewAPIClient(c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewClient() *Client { subClient, _ := NewClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagementGroupSubscriptionsClient() *ManagementGroupSubscriptionsClient { - subClient, _ := NewManagementGroupSubscriptionsClient(c.credential, c.options) +func (c *ClientFactory) NewEntitiesClient() *EntitiesClient { + subClient, _ := NewEntitiesClient(c.credential, c.options) return subClient } @@ -51,17 +55,12 @@ func (c *ClientFactory) NewHierarchySettingsClient() *HierarchySettingsClient { return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewAPIClient() *APIClient { - subClient, _ := NewAPIClient(c.credential, c.options) +func (c *ClientFactory) NewManagementGroupSubscriptionsClient() *ManagementGroupSubscriptionsClient { + subClient, _ := NewManagementGroupSubscriptionsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewEntitiesClient() *EntitiesClient { - subClient, _ := NewEntitiesClient(c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/constants.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/constants.go index 74068c7fef48..80663d0e36f8 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/constants.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/constants.go @@ -3,15 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups const ( moduleName = "armmanagementgroups" - moduleVersion = "v1.1.0" + moduleVersion = "v1.1.1" ) type EntitySearchType string @@ -113,15 +112,15 @@ func PossiblePermissionsValues() []Permissions { type Reason string const ( - ReasonInvalid Reason = "Invalid" ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" ) // PossibleReasonValues returns the possible values for the Reason const type. func PossibleReasonValues() []Reason { return []Reason{ - ReasonInvalid, ReasonAlreadyExists, + ReasonInvalid, } } @@ -129,22 +128,22 @@ func PossibleReasonValues() []Reason { type Status string const ( + StatusCancelled Status = "Cancelled" + StatusCompleted Status = "Completed" + StatusFailed Status = "Failed" StatusNotStarted Status = "NotStarted" StatusNotStartedButGroupsExist Status = "NotStartedButGroupsExist" StatusStarted Status = "Started" - StatusFailed Status = "Failed" - StatusCancelled Status = "Cancelled" - StatusCompleted Status = "Completed" ) // PossibleStatusValues returns the possible values for the Status const type. func PossibleStatusValues() []Status { return []Status{ + StatusCancelled, + StatusCompleted, + StatusFailed, StatusNotStarted, StatusNotStartedButGroupsExist, StatusStarted, - StatusFailed, - StatusCancelled, - StatusCompleted, } } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client.go index 2cd5c9c16967..2fcfe2549ddb 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups @@ -41,7 +40,7 @@ func NewEntitiesClient(credential azcore.TokenCredential, options *arm.ClientOpt // NewListPager - List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. // -// Generated from API version 2021-04-01 +// Generated from API version 2023-04-01 // - 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]{ @@ -79,7 +78,7 @@ func (client *EntitiesClient) listCreateRequest(ctx context.Context, options *En return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client_example_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client_example_test.go deleted file mode 100644 index 3b385f31004e..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/entities_client_example_test.go +++ /dev/null @@ -1,101 +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. -// DO NOT EDIT. - -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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEntitiesClient().NewListPager(&armmanagementgroups.EntitiesClientListOptions{Skiptoken: nil, - Skip: nil, - Top: nil, - Select: nil, - Search: nil, - Filter: nil, - View: nil, - GroupName: nil, - CacheControl: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EntityListResult = armmanagementgroups.EntityListResult{ - // Value: []*armmanagementgroups.EntityInfo{ - // { - // Name: to.Ptr("20000000-0001-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), - // Properties: &armmanagementgroups.EntityInfoProperties{ - // DisplayName: to.Ptr("Group 1 Tenant 2"), - // InheritedPermissions: to.Ptr(armmanagementgroups.PermissionsView), - // NumberOfChildGroups: to.Ptr[int32](1), - // NumberOfChildren: to.Ptr[int32](2), - // NumberOfDescendants: to.Ptr[int32](3), - // Parent: &armmanagementgroups.EntityParentGroupInfo{ - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000"), - // }, - // ParentDisplayNameChain: []*string{ - // to.Ptr("Tenant Root Group"), - // to.Ptr("Group 1 Tenant 2 Parent")}, - // ParentNameChain: []*string{ - // to.Ptr("TenantRootGroup"), - // to.Ptr("Group1Tenant2Parent")}, - // Permissions: to.Ptr(armmanagementgroups.PermissionsView), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("20000000-0004-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Management/managementGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0004-0000-0000-000000000000"), - // Properties: &armmanagementgroups.EntityInfoProperties{ - // DisplayName: to.Ptr("Group 4 Tenant 2"), - // InheritedPermissions: to.Ptr(armmanagementgroups.PermissionsDelete), - // NumberOfChildGroups: to.Ptr[int32](0), - // NumberOfChildren: to.Ptr[int32](0), - // NumberOfDescendants: to.Ptr[int32](0), - // Parent: &armmanagementgroups.EntityParentGroupInfo{ - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000"), - // }, - // ParentDisplayNameChain: []*string{ - // to.Ptr("Tenant Root Group"), - // to.Ptr("Group 4 Tenant 2 Parent")}, - // ParentNameChain: []*string{ - // to.Ptr("TenantRootGroup"), - // to.Ptr("Group4 Tenant2Parent")}, - // Permissions: to.Ptr(armmanagementgroups.PermissionsDelete), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod index 7085e9b30dd2..3e5161ae80c0 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod @@ -3,14 +3,14 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/ar go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.7.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -21,9 +21,9 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v2 v2.4.0 // 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 6e2c77825a2c..93fdfc2850cd 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum @@ -1,9 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= @@ -31,13 +31,13 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client.go index a7deabc481e4..07b6a1c3142e 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups @@ -44,24 +43,27 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, groupID, createTenantSettingsRequest, options) if err != nil { return HierarchySettingsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HierarchySettingsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HierarchySettingsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HierarchySettingsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -76,10 +78,13 @@ func (client *HierarchySettingsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createTenantSettingsRequest) + if err := runtime.MarshalAsJSON(req, createTenantSettingsRequest); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -94,21 +99,23 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.deleteCreateRequest(ctx, groupID, options) if err != nil { return HierarchySettingsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HierarchySettingsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HierarchySettingsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HierarchySettingsClientDeleteResponse{}, err } return HierarchySettingsClientDeleteResponse{}, nil } @@ -125,7 +132,7 @@ func (client *HierarchySettingsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -135,22 +142,25 @@ func (client *HierarchySettingsClient) deleteCreateRequest(ctx context.Context, // Group of the hierarchy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-04-01 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.getCreateRequest(ctx, groupID, options) if err != nil { return HierarchySettingsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HierarchySettingsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HierarchySettingsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HierarchySettingsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -165,7 +175,7 @@ func (client *HierarchySettingsClient) getCreateRequest(ctx context.Context, gro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,22 +194,25 @@ func (client *HierarchySettingsClient) getHandleResponse(resp *http.Response) (H // Group of the hierarchy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-04-01 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.listCreateRequest(ctx, groupID, options) if err != nil { return HierarchySettingsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HierarchySettingsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HierarchySettingsClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HierarchySettingsClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -214,7 +227,7 @@ func (client *HierarchySettingsClient) listCreateRequest(ctx context.Context, gr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,24 +245,27 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.updateCreateRequest(ctx, groupID, createTenantSettingsRequest, options) if err != nil { return HierarchySettingsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HierarchySettingsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HierarchySettingsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HierarchySettingsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -264,10 +280,13 @@ func (client *HierarchySettingsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createTenantSettingsRequest) + if err := runtime.MarshalAsJSON(req, createTenantSettingsRequest); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client_example_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client_example_test.go deleted file mode 100644 index 875aba4e1efe..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/hierarchysettings_client_example_test.go +++ /dev/null @@ -1,169 +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. -// DO NOT EDIT. - -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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHierarchySettingsClient().List(ctx, "root", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HierarchySettingsList = armmanagementgroups.HierarchySettingsList{ - // Value: []*armmanagementgroups.HierarchySettingsInfo{ - // { - // Name: to.Ptr("root"), - // Type: to.Ptr("Microsoft.Management/managementGroups/settings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/root/settings/default"), - // Properties: &armmanagementgroups.HierarchySettingsProperties{ - // DefaultManagementGroup: to.Ptr("/providers/Microsoft.Management/managementGroups/DefaultGroup"), - // RequireAuthorizationForGroupCreation: to.Ptr(true), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHierarchySettingsClient().Get(ctx, "root", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HierarchySettings = armmanagementgroups.HierarchySettings{ - // Name: to.Ptr("root"), - // Type: to.Ptr("Microsoft.Management/managementGroups/settings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/root/settings/default"), - // Properties: &armmanagementgroups.HierarchySettingsProperties{ - // DefaultManagementGroup: to.Ptr("/providers/Microsoft.Management/managementGroups/DefaultGroup"), - // RequireAuthorizationForGroupCreation: to.Ptr(true), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHierarchySettingsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HierarchySettings = armmanagementgroups.HierarchySettings{ - // Name: to.Ptr("root"), - // Type: to.Ptr("Microsoft.Management/managementGroups/settings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/root/settings/default"), - // Properties: &armmanagementgroups.HierarchySettingsProperties{ - // DefaultManagementGroup: to.Ptr("/providers/Microsoft.Management/managementGroups/DefaultGroup"), - // RequireAuthorizationForGroupCreation: to.Ptr(true), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHierarchySettingsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HierarchySettings = armmanagementgroups.HierarchySettings{ - // Name: to.Ptr("root"), - // Type: to.Ptr("Microsoft.Management/managementGroups/settings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/root/settings/default"), - // Properties: &armmanagementgroups.HierarchySettingsProperties{ - // DefaultManagementGroup: to.Ptr("/providers/Microsoft.Management/managementGroups/DefaultGroup"), - // RequireAuthorizationForGroupCreation: to.Ptr(true), - // TenantID: to.Ptr("20000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewHierarchySettingsClient().Delete(ctx, "root", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client.go index d159d4e8b72a..8eabbbf8a29f 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups @@ -44,24 +43,27 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.createCreateRequest(ctx, groupID, subscriptionID, options) if err != nil { return ManagementGroupSubscriptionsClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagementGroupSubscriptionsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementGroupSubscriptionsClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementGroupSubscriptionsClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -80,7 +82,7 @@ func (client *ManagementGroupSubscriptionsClient) createCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.CacheControl != nil { req.Raw().Header["Cache-Control"] = []string{*options.CacheControl} @@ -101,22 +103,24 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.deleteCreateRequest(ctx, groupID, subscriptionID, options) if err != nil { return ManagementGroupSubscriptionsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagementGroupSubscriptionsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ManagementGroupSubscriptionsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ManagementGroupSubscriptionsClientDeleteResponse{}, err } return ManagementGroupSubscriptionsClientDeleteResponse{}, nil } @@ -137,7 +141,7 @@ func (client *ManagementGroupSubscriptionsClient) deleteCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.CacheControl != nil { req.Raw().Header["Cache-Control"] = []string{*options.CacheControl} @@ -149,24 +153,27 @@ 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 +// Generated from API version 2023-04-01 // - 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) { + var err error req, err := client.getSubscriptionCreateRequest(ctx, groupID, subscriptionID, options) if err != nil { return ManagementGroupSubscriptionsClientGetSubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagementGroupSubscriptionsClientGetSubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementGroupSubscriptionsClientGetSubscriptionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementGroupSubscriptionsClientGetSubscriptionResponse{}, err } - return client.getSubscriptionHandleResponse(resp) + resp, err := client.getSubscriptionHandleResponse(httpResp) + return resp, err } // getSubscriptionCreateRequest creates the GetSubscription request. @@ -185,7 +192,7 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.CacheControl != nil { req.Raw().Header["Cache-Control"] = []string{*options.CacheControl} @@ -206,7 +213,7 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionHandleResponse( // NewGetSubscriptionsUnderManagementGroupPager - Retrieves details about all subscriptions which are associated with the // management group. // -// Generated from API version 2021-04-01 +// Generated from API version 2023-04-01 // - groupID - Management Group ID. // - options - ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions contains the optional parameters // for the ManagementGroupSubscriptionsClient.NewGetSubscriptionsUnderManagementGroupPager method. @@ -250,7 +257,7 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionsUnderManagemen return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client_example_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client_example_test.go deleted file mode 100644 index 2d56ba63ba59..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/managementgroupsubscriptions_client_example_test.go +++ /dev/null @@ -1,143 +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. -// DO NOT EDIT. - -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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementGroupSubscriptionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionUnderManagementGroup = armmanagementgroups.SubscriptionUnderManagementGroup{ - // Name: to.Ptr("728bcbe4-8d56-4510-86c2-4921b8beefbc"), - // Type: to.Ptr("Microsoft.Management/managementGroups/subscriptions"), - // ID: to.Ptr(" /providers/Microsoft.Management/managementGroups/Group/subscriptions/728bcbe4-8d56-4510-86c2-4921b8beefbc"), - // Properties: &armmanagementgroups.SubscriptionUnderManagementGroupProperties{ - // DisplayName: to.Ptr("Group"), - // Parent: &armmanagementgroups.DescendantParentGroupInfo{ - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/Group"), - // }, - // State: to.Ptr("Active"), - // Tenant: to.Ptr("e751ac82-623b-4913-8d74-22637c832373"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagementGroupSubscriptionsClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementGroupSubscriptionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionUnderManagementGroup = armmanagementgroups.SubscriptionUnderManagementGroup{ - // Name: to.Ptr("728bcbe4-8d56-4510-86c2-4921b8beefbc"), - // Type: to.Ptr("Microsoft.Management/managementGroups/subscriptions"), - // ID: to.Ptr(" /providers/Microsoft.Management/managementGroups/Group/subscriptions/728bcbe4-8d56-4510-86c2-4921b8beefbc"), - // Properties: &armmanagementgroups.SubscriptionUnderManagementGroupProperties{ - // DisplayName: to.Ptr("Group"), - // Parent: &armmanagementgroups.DescendantParentGroupInfo{ - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/Group"), - // }, - // State: to.Ptr("Active"), - // Tenant: to.Ptr("e751ac82-623b-4913-8d74-22637c832373"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementGroupSubscriptionsClient().NewGetSubscriptionsUnderManagementGroupPager("Group", &armmanagementgroups.ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions{Skiptoken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListSubscriptionUnderManagementGroup = armmanagementgroups.ListSubscriptionUnderManagementGroup{ - // Value: []*armmanagementgroups.SubscriptionUnderManagementGroup{ - // { - // Name: to.Ptr("728bcbe4-8d56-4510-86c2-4921b8beefbc"), - // Type: to.Ptr("Microsoft.Management/managementGroups/subscriptions"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/Group/subscriptions/728bcbe4-8d56-4510-86c2-4921b8beefbc"), - // Properties: &armmanagementgroups.SubscriptionUnderManagementGroupProperties{ - // DisplayName: to.Ptr("S5"), - // Parent: &armmanagementgroups.DescendantParentGroupInfo{ - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/Group"), - // }, - // State: to.Ptr("Active"), - // Tenant: to.Ptr("e751ac82-623b-4913-8d74-22637c832373"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/models.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/models.go index 5e531d326024..c9377fe3913d 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/models.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/models.go @@ -3,54 +3,38 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups import "time" -// APIClientCheckNameAvailabilityOptions contains the optional parameters for the APIClient.CheckNameAvailability method. -type APIClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// APIClientStartTenantBackfillOptions contains the optional parameters for the APIClient.StartTenantBackfill method. -type APIClientStartTenantBackfillOptions struct { - // placeholder for future optional parameters -} - -// APIClientTenantBackfillStatusOptions contains the optional parameters for the APIClient.TenantBackfillStatus method. -type APIClientTenantBackfillStatusOptions struct { - // placeholder for future optional parameters -} - // AzureAsyncOperationResults - The results of Azure-AsyncOperation. type AzureAsyncOperationResults struct { // The generic properties of a management group. - Properties *ManagementGroupInfoProperties `json:"properties,omitempty"` + Properties *ManagementGroupInfoProperties // READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The current status of the asynchronous operation performed . For example, Running, Succeeded, Failed - Status *string `json:"status,omitempty" azure:"ro"` + Status *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // CheckNameAvailabilityRequest - Management group name availability check parameters. type CheckNameAvailabilityRequest struct { // the name to check for availability - Name *string `json:"name,omitempty"` + Name *string // fully qualified resource type which includes provider namespace - Type *string `json:"type,omitempty"` + Type *string } // CheckNameAvailabilityResult - Describes the result of the request to check management group name availability. @@ -59,701 +43,542 @@ type CheckNameAvailabilityResult struct { // given name is invalid, and provide the resource naming requirements so that the user can // select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a different // name. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string // READ-ONLY; Required. True indicates name is valid and available. False indicates the name is invalid, unavailable, or both. - NameAvailable *bool `json:"nameAvailable,omitempty" azure:"ro"` + NameAvailable *bool // READ-ONLY; Required if nameAvailable == false. Invalid indicates the name provided does not match the resource provider's // naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists // indicates that the name is already in use and is therefore unavailable. - Reason *Reason `json:"reason,omitempty" azure:"ro"` -} - -// ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. -type ClientBeginCreateOrUpdateOptions struct { - // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. - CacheControl *string - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. -type ClientBeginDeleteOptions struct { - // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. - CacheControl *string - // Resumes the LRO from the provided token. - ResumeToken string -} - -// 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 - // parameter that specifies a starting point to use for subsequent calls. - Skiptoken *string - // Number of elements to return when retrieving results. Passing this in will override $skipToken. - Top *int32 -} - -// ClientGetOptions contains the optional parameters for the Client.Get method. -type ClientGetOptions struct { - // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. - CacheControl *string - // The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path - // includes the path from the root group to the current group. - // $expand=ancestors includes the ancestor Ids of the current group. - Expand *ManagementGroupExpandType - // A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription') - Filter *string - // The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. - // Note that $expand=children must be passed up if $recurse is set to true. - Recurse *bool -} - -// 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 - // 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 - // parameter that specifies a starting point to use for subsequent calls. - Skiptoken *string -} - -// ClientUpdateOptions contains the optional parameters for the Client.Update method. -type ClientUpdateOptions struct { - // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. - CacheControl *string + Reason *Reason } // CreateManagementGroupChildInfo - The child information of a management group used during creation. type CreateManagementGroupChildInfo struct { // READ-ONLY; The list of children. - Children []*CreateManagementGroupChildInfo `json:"children,omitempty" azure:"ro"` + Children []*CreateManagementGroupChildInfo // READ-ONLY; The friendly name of the child resource. - DisplayName *string `json:"displayName,omitempty" azure:"ro"` + DisplayName *string // READ-ONLY; The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the child entity. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups) - Type *ManagementGroupChildType `json:"type,omitempty" azure:"ro"` + Type *ManagementGroupChildType } // CreateManagementGroupDetails - The details of a management group used during creation. type CreateManagementGroupDetails struct { // (Optional) The ID of the parent management group used during creation. - Parent *CreateParentGroupInfo `json:"parent,omitempty"` + Parent *CreateParentGroupInfo // READ-ONLY; The identity of the principal or process that updated the object. - UpdatedBy *string `json:"updatedBy,omitempty" azure:"ro"` + UpdatedBy *string // READ-ONLY; The date and time when this object was last updated. - UpdatedTime *time.Time `json:"updatedTime,omitempty" azure:"ro"` + UpdatedTime *time.Time // READ-ONLY; The version number of the object. - Version *int32 `json:"version,omitempty" azure:"ro"` + Version *int32 } // CreateManagementGroupProperties - The generic properties of a management group used during creation. type CreateManagementGroupProperties struct { // The details of a management group used during creation. - Details *CreateManagementGroupDetails `json:"details,omitempty"` + Details *CreateManagementGroupDetails // The friendly name of the management group. If no value is passed then this field will be set to the groupId. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // READ-ONLY; The list of children. - Children []*CreateManagementGroupChildInfo `json:"children,omitempty" azure:"ro"` + Children []*CreateManagementGroupChildInfo // READ-ONLY; The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 - TenantID *string `json:"tenantId,omitempty" azure:"ro"` + TenantID *string } // CreateManagementGroupRequest - Management group creation parameters. type CreateManagementGroupRequest struct { // The name of the management group. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty"` + Name *string // The generic properties of a management group used during creation. - Properties *CreateManagementGroupProperties `json:"properties,omitempty"` + Properties *CreateManagementGroupProperties // READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // CreateOrUpdateSettingsProperties - The properties of the request to create or update Management Group settings type CreateOrUpdateSettingsProperties struct { // Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup - DefaultManagementGroup *string `json:"defaultManagementGroup,omitempty"` + DefaultManagementGroup *string // Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, user will // require Microsoft.Management/managementGroups/write action on the root // Management Group scope in order to create new Groups directly under the root. This will prevent new users from creating // new Management Groups, unless they are given access. - RequireAuthorizationForGroupCreation *bool `json:"requireAuthorizationForGroupCreation,omitempty"` + RequireAuthorizationForGroupCreation *bool } // CreateOrUpdateSettingsRequest - Parameters for creating or updating Management Group settings type CreateOrUpdateSettingsRequest struct { // The properties of the request to create or update Management Group settings - Properties *CreateOrUpdateSettingsProperties `json:"properties,omitempty"` + Properties *CreateOrUpdateSettingsProperties } // CreateParentGroupInfo - (Optional) The ID of the parent management group used during creation. type CreateParentGroupInfo struct { // 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"` + ID *string // READ-ONLY; The friendly name of the parent management group. - DisplayName *string `json:"displayName,omitempty" azure:"ro"` + DisplayName *string // READ-ONLY; The name of the parent management group - Name *string `json:"name,omitempty" azure:"ro"` + Name *string } // DescendantInfo - The descendant. type DescendantInfo struct { // The generic properties of an descendant. - Properties *DescendantInfoProperties `json:"properties,omitempty"` + Properties *DescendantInfoProperties // READ-ONLY; The fully qualified ID for the descendant. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 // or /subscriptions/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the descendant. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups or /subscriptions - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DescendantInfoProperties - The generic properties of an descendant. type DescendantInfoProperties struct { // The friendly name of the management group. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // The ID of the parent management group. - Parent *DescendantParentGroupInfo `json:"parent,omitempty"` + Parent *DescendantParentGroupInfo } // DescendantListResult - Describes the result of the request to view descendants. type DescendantListResult struct { // The list of descendants. - Value []*DescendantInfo `json:"value,omitempty"` + Value []*DescendantInfo // READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // DescendantParentGroupInfo - The ID of the parent management group. type DescendantParentGroupInfo struct { // 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"` -} - -// 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 - // The filter parameter allows you to filter on the the name or display name fields. You can check for equality on the name - // field (e.g. name eq '{entityName}') and you can check for substrings on either - // the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). - // Note that the '{entityName}' and '{substringToSearch}' fields are checked case - // insensitively. - Filter *string - // A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'") - GroupName *string - // The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on - // the parameter passed in. With $search=AllowedParents the API will return the - // entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. - // With $search=AllowedChildren the API will return the entity info of all - // entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return - // the parent and first level of children that the user has either direct - // access to or indirect access via one of their descendants. With $search=ParentOnly the API will return only the group if - // the user has access to at least one of the descendants of the group. With - // $search=ChildrenOnly the API will return only the first level of children of the group entity info specified in $filter. - // The user must have direct access to the children entities or one of it's - // descendants for it to show up in the results. - Search *EntitySearchType - // This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, - // e.g. - // '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override - // select in $skipToken. - Select *string - // Number of entities to skip over when retrieving results. Passing this in will override $skipToken. - Skip *int32 - // 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 - // parameter that specifies a starting point to use for subsequent calls. - Skiptoken *string - // Number of elements to return when retrieving results. Passing this in will override $skipToken. - Top *int32 - // The view parameter allows clients to filter the type of data that is returned by the getEntities call. - View *EntityViewParameterType + ID *string } // EntityHierarchyItem - The management group details for the hierarchy view. type EntityHierarchyItem struct { // The generic properties of a management group. - Properties *EntityHierarchyItemProperties `json:"properties,omitempty"` + Properties *EntityHierarchyItemProperties // READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // EntityHierarchyItemProperties - The generic properties of a management group. type EntityHierarchyItemProperties struct { // The list of children. - Children []*EntityHierarchyItem `json:"children,omitempty"` + Children []*EntityHierarchyItem // The friendly name of the management group. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // The users specific permissions to this item. - Permissions *Permissions `json:"permissions,omitempty"` + Permissions *Permissions } // EntityInfo - The entity. type EntityInfo struct { // The generic properties of an entity. - Properties *EntityInfoProperties `json:"properties,omitempty"` + Properties *EntityInfoProperties // READ-ONLY; The fully qualified ID for the entity. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the entity. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // EntityInfoProperties - The generic properties of an entity. type EntityInfoProperties struct { // The friendly name of the management group. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // The users specific permissions to this item. - InheritedPermissions *Permissions `json:"inheritedPermissions,omitempty"` + InheritedPermissions *Permissions // Number of children is the number of Groups that are exactly one level underneath the current Group. - NumberOfChildGroups *int32 `json:"numberOfChildGroups,omitempty"` + NumberOfChildGroups *int32 // Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current Group. - NumberOfChildren *int32 `json:"numberOfChildren,omitempty"` + NumberOfChildren *int32 // Number of Descendants - NumberOfDescendants *int32 `json:"numberOfDescendants,omitempty"` + NumberOfDescendants *int32 // (Optional) The ID of the parent management group. - Parent *EntityParentGroupInfo `json:"parent,omitempty"` + Parent *EntityParentGroupInfo // The parent display name chain from the root group to the immediate parent - ParentDisplayNameChain []*string `json:"parentDisplayNameChain,omitempty"` + ParentDisplayNameChain []*string // The parent name chain from the root group to the immediate parent - ParentNameChain []*string `json:"parentNameChain,omitempty"` + ParentNameChain []*string // The users specific permissions to this item. - Permissions *Permissions `json:"permissions,omitempty"` + Permissions *Permissions // The AAD Tenant ID associated with the entity. For example, 00000000-0000-0000-0000-000000000000 - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } // EntityListResult - Describes the result of the request to view entities. type EntityListResult struct { // The list of entities. - Value []*EntityInfo `json:"value,omitempty"` + Value []*EntityInfo // READ-ONLY; Total count of records that match the filter - Count *int32 `json:"count,omitempty" azure:"ro"` + Count *int32 // READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // EntityParentGroupInfo - (Optional) The ID of the parent management group. type EntityParentGroupInfo struct { // 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"` + ID *string } // ErrorDetails - The details of the error. type ErrorDetails struct { // One of a server-defined set of error codes. - Code *string `json:"code,omitempty"` + Code *string // A human-readable representation of the error's details. - Details *string `json:"details,omitempty"` + Details *string // A human-readable representation of the error. - Message *string `json:"message,omitempty"` + Message *string } // ErrorResponse - The error object. type ErrorResponse struct { // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` + Error *ErrorDetails } // HierarchySettings - Settings defined at the Management Group scope. type HierarchySettings struct { // The generic properties of hierarchy settings. - Properties *HierarchySettingsProperties `json:"properties,omitempty"` + Properties *HierarchySettingsProperties // READ-ONLY; The fully qualified ID for the settings object. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the object. In this case, default. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups/settings. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// HierarchySettingsClientCreateOrUpdateOptions contains the optional parameters for the HierarchySettingsClient.CreateOrUpdate -// method. -type HierarchySettingsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// HierarchySettingsClientDeleteOptions contains the optional parameters for the HierarchySettingsClient.Delete method. -type HierarchySettingsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// HierarchySettingsClientGetOptions contains the optional parameters for the HierarchySettingsClient.Get method. -type HierarchySettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// HierarchySettingsClientListOptions contains the optional parameters for the HierarchySettingsClient.List method. -type HierarchySettingsClientListOptions struct { - // placeholder for future optional parameters -} - -// HierarchySettingsClientUpdateOptions contains the optional parameters for the HierarchySettingsClient.Update method. -type HierarchySettingsClientUpdateOptions struct { - // placeholder for future optional parameters + Type *string } // HierarchySettingsInfo - The hierarchy settings resource. type HierarchySettingsInfo struct { // The generic properties of hierarchy settings. - Properties *HierarchySettingsProperties `json:"properties,omitempty"` + Properties *HierarchySettingsProperties // READ-ONLY; The fully qualified ID for the settings object. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the object. In this case, default. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups/settings. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // HierarchySettingsList - Lists all hierarchy settings. type HierarchySettingsList struct { // The list of hierarchy settings. - Value []*HierarchySettingsInfo `json:"value,omitempty"` + Value []*HierarchySettingsInfo // READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // HierarchySettingsProperties - The generic properties of hierarchy settings. type HierarchySettingsProperties struct { // Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup - DefaultManagementGroup *string `json:"defaultManagementGroup,omitempty"` + DefaultManagementGroup *string // Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, user will // require Microsoft.Management/managementGroups/write action on the root // Management Group scope in order to create new Groups directly under the root. This will prevent new users from creating // new Management Groups, unless they are given access. - RequireAuthorizationForGroupCreation *bool `json:"requireAuthorizationForGroupCreation,omitempty"` + RequireAuthorizationForGroupCreation *bool // The AAD Tenant ID associated with the hierarchy settings. For example, 00000000-0000-0000-0000-000000000000 - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } // ListSubscriptionUnderManagementGroup - The details of all subscriptions under management group. type ListSubscriptionUnderManagementGroup struct { // The list of subscriptions. - Value []*SubscriptionUnderManagementGroup `json:"value,omitempty"` + Value []*SubscriptionUnderManagementGroup // READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // ManagementGroup - The management group details. type ManagementGroup struct { // The generic properties of a management group. - Properties *ManagementGroupProperties `json:"properties,omitempty"` + Properties *ManagementGroupProperties // READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagementGroupChildInfo - The child information of a management group. type ManagementGroupChildInfo struct { // The list of children. - Children []*ManagementGroupChildInfo `json:"children,omitempty"` + Children []*ManagementGroupChildInfo // The friendly name of the child resource. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty"` + ID *string // The name of the child entity. - Name *string `json:"name,omitempty"` + Name *string // The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups) - Type *ManagementGroupChildType `json:"type,omitempty"` + Type *ManagementGroupChildType } // ManagementGroupDetails - The details of a management group. type ManagementGroupDetails struct { // The ancestors of the management group. - ManagementGroupAncestors []*string `json:"managementGroupAncestors,omitempty"` + ManagementGroupAncestors []*string // The ancestors of the management group displayed in reversed order, from immediate parent to the root. - ManagementGroupAncestorsChain []*ManagementGroupPathElement `json:"managementGroupAncestorsChain,omitempty"` + ManagementGroupAncestorsChain []*ManagementGroupPathElement // (Optional) The ID of the parent management group. - Parent *ParentGroupInfo `json:"parent,omitempty"` + Parent *ParentGroupInfo // The path from the root to the current group. - Path []*ManagementGroupPathElement `json:"path,omitempty"` + Path []*ManagementGroupPathElement // The identity of the principal or process that updated the object. - UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedBy *string // The date and time when this object was last updated. - UpdatedTime *time.Time `json:"updatedTime,omitempty"` + UpdatedTime *time.Time // The version number of the object. - Version *int32 `json:"version,omitempty"` + Version *int32 } // ManagementGroupInfo - The management group resource. type ManagementGroupInfo struct { // The generic properties of a management group. - Properties *ManagementGroupInfoProperties `json:"properties,omitempty"` + Properties *ManagementGroupInfoProperties // READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagementGroupInfoProperties - The generic properties of a management group. type ManagementGroupInfoProperties struct { // The friendly name of the management group. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } // ManagementGroupListResult - Describes the result of the request to list management groups. type ManagementGroupListResult struct { // The list of management groups. - Value []*ManagementGroupInfo `json:"value,omitempty"` + Value []*ManagementGroupInfo // READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // ManagementGroupPathElement - A path element of a management group ancestors. type ManagementGroupPathElement struct { // The friendly name of the group. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // The name of the group. - Name *string `json:"name,omitempty"` + Name *string } // ManagementGroupProperties - The generic properties of a management group. type ManagementGroupProperties struct { // The list of children. - Children []*ManagementGroupChildInfo `json:"children,omitempty"` + Children []*ManagementGroupChildInfo // The details of a management group. - Details *ManagementGroupDetails `json:"details,omitempty"` + Details *ManagementGroupDetails // The friendly name of the management group. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 - TenantID *string `json:"tenantId,omitempty"` -} - -// ManagementGroupSubscriptionsClientCreateOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Create -// method. -type ManagementGroupSubscriptionsClientCreateOptions struct { - // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. - CacheControl *string -} - -// ManagementGroupSubscriptionsClientDeleteOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Delete -// method. -type ManagementGroupSubscriptionsClientDeleteOptions struct { - // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. - CacheControl *string -} - -// ManagementGroupSubscriptionsClientGetSubscriptionOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.GetSubscription -// method. -type ManagementGroupSubscriptionsClientGetSubscriptionOptions struct { - // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. - CacheControl *string -} - -// ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions contains the optional parameters for the -// 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 - // parameter that specifies a starting point to use for subsequent calls. - Skiptoken *string + TenantID *string } // Operation supported by the Microsoft.Management resource provider. type Operation struct { // The object that represents the operation. - Display *OperationDisplayProperties `json:"display,omitempty"` + Display *OperationDisplayProperties // READ-ONLY; Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string } // OperationDisplayProperties - The object that represents the operation. type OperationDisplayProperties struct { // READ-ONLY; Operation description. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The operation that can be performed. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; The name of the provider. - Provider *string `json:"provider,omitempty" azure:"ro"` + Provider *string // READ-ONLY; The resource on which the operation is performed. - Resource *string `json:"resource,omitempty" azure:"ro"` + Resource *string } // OperationListResult - Describes the result of the request to list Microsoft.Management operations. type OperationListResult struct { // READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; List of operations supported by the Microsoft.Management resource provider. - Value []*Operation `json:"value,omitempty" azure:"ro"` + Value []*Operation } // OperationResults - The results of an asynchronous operation. type OperationResults struct { // The generic properties of a management group. - Properties *ManagementGroupInfoProperties `json:"properties,omitempty"` + Properties *ManagementGroupInfoProperties // READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups - Type *string `json:"type,omitempty" azure:"ro"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters + Type *string } // ParentGroupInfo - (Optional) The ID of the parent management group. type ParentGroupInfo struct { // The friendly name of the parent management group. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // 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"` + ID *string // The name of the parent management group - Name *string `json:"name,omitempty"` + Name *string } // PatchManagementGroupRequest - Management group patch parameters. type PatchManagementGroupRequest struct { // The friendly name of the management group. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // (Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - ParentGroupID *string `json:"parentGroupId,omitempty"` + ParentGroupID *string } // SubscriptionUnderManagementGroup - The details of subscription under management group. type SubscriptionUnderManagementGroup struct { // The generic properties of subscription under a management group. - Properties *SubscriptionUnderManagementGroupProperties `json:"properties,omitempty"` + Properties *SubscriptionUnderManagementGroupProperties // READ-ONLY; The fully qualified ID for the subscription. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/subscriptions/0000000-0000-0000-0000-000000000001 - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The stringified id of the subscription. For example, 00000000-0000-0000-0000-000000000000 - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups/subscriptions - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SubscriptionUnderManagementGroupProperties - The generic properties of subscription under a management group. type SubscriptionUnderManagementGroupProperties struct { // The friendly name of the subscription. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // The ID of the parent management group. - Parent *DescendantParentGroupInfo `json:"parent,omitempty"` + Parent *DescendantParentGroupInfo // The state of the subscription. - State *string `json:"state,omitempty"` + State *string // The AAD Tenant ID associated with the subscription. For example, 00000000-0000-0000-0000-000000000000 - Tenant *string `json:"tenant,omitempty"` + Tenant *string } // TenantBackfillStatusResult - The tenant backfill status type TenantBackfillStatusResult struct { // READ-ONLY; The status of the Tenant Backfill - Status *Status `json:"status,omitempty" azure:"ro"` + Status *Status // READ-ONLY; The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 - TenantID *string `json:"tenantId,omitempty" azure:"ro"` + TenantID *string } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/models_serde.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/models_serde.go index ecaec01eba30..c0a804a3ba96 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/models_serde.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/models_serde.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups @@ -887,7 +886,7 @@ func (h *HierarchySettingsInfo) UnmarshalJSON(data []byte) error { // 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, "@nextLink", h.NextLink) populate(objectMap, "value", h.Value) return json.Marshal(objectMap) } @@ -901,7 +900,7 @@ func (h *HierarchySettingsList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": + case "@nextLink": err = unpopulate(val, "NextLink", &h.NextLink) delete(rawMsg, key) case "value": @@ -1187,7 +1186,7 @@ func (m *ManagementGroupInfoProperties) UnmarshalJSON(data []byte) error { // 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, "@nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -1201,7 +1200,7 @@ func (m *ManagementGroupListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": + case "@nextLink": err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) case "value": diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client.go index 0e709482a2dd..64026e9d6dbc 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Management REST API operations. // -// Generated from API version 2021-04-01 +// Generated from API version 2023-04-01 // - 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]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01") + reqQP.Set("api-version", "2023-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client_example_test.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client_example_test.go deleted file mode 100644 index 69167c290455..000000000000 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/operations_client_example_test.go +++ /dev/null @@ -1,55 +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. -// DO NOT EDIT. - -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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armmanagementgroups.OperationListResult{ - // Value: []*armmanagementgroups.Operation{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Display: &armmanagementgroups.OperationDisplayProperties{ - // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Operation: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Provider: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Resource: to.Ptr("aaaaaaaaaaaaa"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/options.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/options.go new file mode 100644 index 000000000000..69c9adccccae --- /dev/null +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/options.go @@ -0,0 +1,198 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmanagementgroups + +// APIClientCheckNameAvailabilityOptions contains the optional parameters for the APIClient.CheckNameAvailability method. +type APIClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// APIClientStartTenantBackfillOptions contains the optional parameters for the APIClient.StartTenantBackfill method. +type APIClientStartTenantBackfillOptions struct { + // placeholder for future optional parameters +} + +// APIClientTenantBackfillStatusOptions contains the optional parameters for the APIClient.TenantBackfillStatus method. +type APIClientTenantBackfillStatusOptions struct { + // placeholder for future optional parameters +} + +// ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. +type ClientBeginCreateOrUpdateOptions struct { + // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + CacheControl *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. +type ClientBeginDeleteOptions struct { + // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + CacheControl *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// 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 + // parameter that specifies a starting point to use for subsequent calls. + Skiptoken *string + + // Number of elements to return when retrieving results. Passing this in will override $skipToken. + Top *int32 +} + +// ClientGetOptions contains the optional parameters for the Client.Get method. +type ClientGetOptions struct { + // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + CacheControl *string + + // The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path + // includes the path from the root group to the current group. + // $expand=ancestors includes the ancestor Ids of the current group. + Expand *ManagementGroupExpandType + + // A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription') + Filter *string + + // The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. + // Note that $expand=children must be passed up if $recurse is set to true. + Recurse *bool +} + +// 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 + + // 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 + // parameter that specifies a starting point to use for subsequent calls. + Skiptoken *string +} + +// ClientUpdateOptions contains the optional parameters for the Client.Update method. +type ClientUpdateOptions struct { + // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + CacheControl *string +} + +// 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 + + // The filter parameter allows you to filter on the the name or display name fields. You can check for equality on the name + // field (e.g. name eq '{entityName}') and you can check for substrings on either + // the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). + // Note that the '{entityName}' and '{substringToSearch}' fields are checked case + // insensitively. + Filter *string + + // A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + GroupName *string + + // The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on + // the parameter passed in. With $search=AllowedParents the API will return the + // entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + // With $search=AllowedChildren the API will return the entity info of all + // entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return + // the parent and first level of children that the user has either direct + // access to or indirect access via one of their descendants. With $search=ParentOnly the API will return only the group if + // the user has access to at least one of the descendants of the group. With + // $search=ChildrenOnly the API will return only the first level of children of the group entity info specified in $filter. + // The user must have direct access to the children entities or one of it's + // descendants for it to show up in the results. + Search *EntitySearchType + + // This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, + // e.g. + // '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override + // select in $skipToken. + Select *string + + // Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + Skip *int32 + + // 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 + // parameter that specifies a starting point to use for subsequent calls. + Skiptoken *string + + // Number of elements to return when retrieving results. Passing this in will override $skipToken. + Top *int32 + + // The view parameter allows clients to filter the type of data that is returned by the getEntities call. + View *EntityViewParameterType +} + +// HierarchySettingsClientCreateOrUpdateOptions contains the optional parameters for the HierarchySettingsClient.CreateOrUpdate +// method. +type HierarchySettingsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// HierarchySettingsClientDeleteOptions contains the optional parameters for the HierarchySettingsClient.Delete method. +type HierarchySettingsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// HierarchySettingsClientGetOptions contains the optional parameters for the HierarchySettingsClient.Get method. +type HierarchySettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// HierarchySettingsClientListOptions contains the optional parameters for the HierarchySettingsClient.List method. +type HierarchySettingsClientListOptions struct { + // placeholder for future optional parameters +} + +// HierarchySettingsClientUpdateOptions contains the optional parameters for the HierarchySettingsClient.Update method. +type HierarchySettingsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagementGroupSubscriptionsClientCreateOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Create +// method. +type ManagementGroupSubscriptionsClientCreateOptions struct { + // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + CacheControl *string +} + +// ManagementGroupSubscriptionsClientDeleteOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.Delete +// method. +type ManagementGroupSubscriptionsClientDeleteOptions struct { + // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + CacheControl *string +} + +// ManagementGroupSubscriptionsClientGetSubscriptionOptions contains the optional parameters for the ManagementGroupSubscriptionsClient.GetSubscription +// method. +type ManagementGroupSubscriptionsClientGetSubscriptionOptions struct { + // Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + CacheControl *string +} + +// ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupOptions contains the optional parameters for the +// 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 + // parameter that specifies a starting point to use for subsequent calls. + Skiptoken *string +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/response_types.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/response_types.go index 76ce4e6c8119..0f39d4b6bd88 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/response_types.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/response_types.go @@ -3,64 +3,74 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups // APIClientCheckNameAvailabilityResponse contains the response from method APIClient.CheckNameAvailability. type APIClientCheckNameAvailabilityResponse struct { + // Describes the result of the request to check management group name availability. CheckNameAvailabilityResult } // APIClientStartTenantBackfillResponse contains the response from method APIClient.StartTenantBackfill. type APIClientStartTenantBackfillResponse struct { + // The tenant backfill status TenantBackfillStatusResult } // APIClientTenantBackfillStatusResponse contains the response from method APIClient.TenantBackfillStatus. type APIClientTenantBackfillStatusResponse struct { + // The tenant backfill status TenantBackfillStatusResult } // ClientCreateOrUpdateResponse contains the response from method Client.BeginCreateOrUpdate. type ClientCreateOrUpdateResponse struct { + // The management group details. ManagementGroup } // ClientDeleteResponse contains the response from method Client.BeginDelete. type ClientDeleteResponse struct { + // The results of Azure-AsyncOperation. AzureAsyncOperationResults } // ClientGetDescendantsResponse contains the response from method Client.NewGetDescendantsPager. type ClientGetDescendantsResponse struct { + // Describes the result of the request to view descendants. DescendantListResult } // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { + // The management group details. ManagementGroup } // ClientListResponse contains the response from method Client.NewListPager. type ClientListResponse struct { + // Describes the result of the request to list management groups. ManagementGroupListResult } // ClientUpdateResponse contains the response from method Client.Update. type ClientUpdateResponse struct { + // The management group details. ManagementGroup } // EntitiesClientListResponse contains the response from method EntitiesClient.NewListPager. type EntitiesClientListResponse struct { + // Describes the result of the request to view entities. EntityListResult } // HierarchySettingsClientCreateOrUpdateResponse contains the response from method HierarchySettingsClient.CreateOrUpdate. type HierarchySettingsClientCreateOrUpdateResponse struct { + // Settings defined at the Management Group scope. HierarchySettings } @@ -71,21 +81,25 @@ type HierarchySettingsClientDeleteResponse struct { // HierarchySettingsClientGetResponse contains the response from method HierarchySettingsClient.Get. type HierarchySettingsClientGetResponse struct { + // Settings defined at the Management Group scope. HierarchySettings } // HierarchySettingsClientListResponse contains the response from method HierarchySettingsClient.List. type HierarchySettingsClientListResponse struct { + // Lists all hierarchy settings. HierarchySettingsList } // HierarchySettingsClientUpdateResponse contains the response from method HierarchySettingsClient.Update. type HierarchySettingsClientUpdateResponse struct { + // Settings defined at the Management Group scope. HierarchySettings } // ManagementGroupSubscriptionsClientCreateResponse contains the response from method ManagementGroupSubscriptionsClient.Create. type ManagementGroupSubscriptionsClientCreateResponse struct { + // The details of subscription under management group. SubscriptionUnderManagementGroup } @@ -96,15 +110,18 @@ type ManagementGroupSubscriptionsClientDeleteResponse struct { // ManagementGroupSubscriptionsClientGetSubscriptionResponse contains the response from method ManagementGroupSubscriptionsClient.GetSubscription. type ManagementGroupSubscriptionsClientGetSubscriptionResponse struct { + // The details of subscription under management group. SubscriptionUnderManagementGroup } // ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse contains the response from method ManagementGroupSubscriptionsClient.NewGetSubscriptionsUnderManagementGroupPager. type ManagementGroupSubscriptionsClientGetSubscriptionsUnderManagementGroupResponse struct { + // The details of all subscriptions under management group. ListSubscriptionUnderManagementGroup } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Describes the result of the request to list Microsoft.Management operations. OperationListResult } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/time_rfc3339.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/time_rfc3339.go index 894b939958eb..829290290f0e 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/time_rfc3339.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagementgroups