diff --git a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md index a95789f7f722..e6c28c956807 100644 --- a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md +++ b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 4.0.1 (2022-11-18) +### Other Changes + + ## 4.0.0 (2022-10-04) ### Breaking Changes diff --git a/sdk/resourcemanager/compute/armcompute/autorest.md b/sdk/resourcemanager/compute/armcompute/autorest.md index 3ece0fc20bc5..34d062eadeb2 100644 --- a/sdk/resourcemanager/compute/armcompute/autorest.md +++ b/sdk/resourcemanager/compute/armcompute/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/20077475fad69cd39ee2408a9c9835bd36a53be3/specification/compute/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/20077475fad69cd39ee2408a9c9835bd36a53be3/specification/compute/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/compute/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/compute/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 4.0.0 +module-version: 4.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go b/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go index 3df6df4b95bf..b365651a2776 100644 --- a/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go +++ b/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go @@ -58,7 +58,7 @@ func NewAvailabilitySetsClient(subscriptionID string, credential azcore.TokenCre // CreateOrUpdate - Create or update an availability set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // availabilitySetName - The name of the availability set. // parameters - Parameters supplied to the Create Availability Set operation. @@ -99,7 +99,7 @@ func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -116,7 +116,7 @@ func (client *AvailabilitySetsClient) createOrUpdateHandleResponse(resp *http.Re // Delete - Delete an availability set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // availabilitySetName - The name of the availability set. // options - AvailabilitySetsClientDeleteOptions contains the optional parameters for the AvailabilitySetsClient.Delete method. @@ -155,7 +155,7 @@ func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -163,7 +163,7 @@ func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, r // Get - Retrieves information about an availability set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // availabilitySetName - The name of the availability set. // options - AvailabilitySetsClientGetOptions contains the optional parameters for the AvailabilitySetsClient.Get method. @@ -202,7 +202,7 @@ func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +218,7 @@ func (client *AvailabilitySetsClient) getHandleResponse(resp *http.Response) (Av } // NewListPager - Lists all availability sets in a resource group. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - AvailabilitySetsClientListOptions contains the optional parameters for the AvailabilitySetsClient.List method. func (client *AvailabilitySetsClient) NewListPager(resourceGroupName string, options *AvailabilitySetsClientListOptions) *runtime.Pager[AvailabilitySetsClientListResponse] { @@ -265,7 +265,7 @@ func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +282,7 @@ func (client *AvailabilitySetsClient) listHandleResponse(resp *http.Response) (A // NewListAvailableSizesPager - Lists all available virtual machine sizes that can be used to create a new virtual machine // in an existing availability set. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // availabilitySetName - The name of the availability set. // options - AvailabilitySetsClientListAvailableSizesOptions contains the optional parameters for the AvailabilitySetsClient.ListAvailableSizes @@ -329,7 +329,7 @@ func (client *AvailabilitySetsClient) listAvailableSizesCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,7 +345,7 @@ func (client *AvailabilitySetsClient) listAvailableSizesHandleResponse(resp *htt } // NewListBySubscriptionPager - Lists all availability sets in a subscription. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.ListBySubscription // method. func (client *AvailabilitySetsClient) NewListBySubscriptionPager(options *AvailabilitySetsClientListBySubscriptionOptions) *runtime.Pager[AvailabilitySetsClientListBySubscriptionResponse] { @@ -388,7 +388,7 @@ func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -408,7 +408,7 @@ func (client *AvailabilitySetsClient) listBySubscriptionHandleResponse(resp *htt // Update - Update an availability set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // availabilitySetName - The name of the availability set. // parameters - Parameters supplied to the Update Availability Set operation. @@ -448,7 +448,7 @@ func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go deleted file mode 100644 index a732f36ad2f5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go +++ /dev/null @@ -1,293 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySet_Create.json -func ExampleAvailabilitySetsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myAvailabilitySet", armcompute.AvailabilitySet{ - Location: to.Ptr("westus"), - Properties: &armcompute.AvailabilitySetProperties{ - PlatformFaultDomainCount: to.Ptr[int32](2), - PlatformUpdateDomainCount: to.Ptr[int32](20), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Update_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Update_availabilitySetsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{ - Tags: map[string]*string{ - "key2574": to.Ptr("aaaaaaaa"), - }, - Properties: &armcompute.AvailabilitySetProperties{ - PlatformFaultDomainCount: to.Ptr[int32](2), - PlatformUpdateDomainCount: to.Ptr[int32](20), - ProximityPlacementGroup: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - VirtualMachines: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("DSv3-Type1"), - Capacity: to.Ptr[int64](7), - Tier: to.Ptr("aaa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Update_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Update_availabilitySetsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Delete_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Delete_availabilitySetsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Delete_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Delete_availabilitySetsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Get_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rgcompute", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Get_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySet_ListBySubscription.json -func ExampleAvailabilitySetsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armcompute.AvailabilitySetsClientListBySubscriptionOptions{Expand: to.Ptr("virtualMachines\\$ref")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_List_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListPager_availabilitySetsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_List_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListPager_availabilitySetsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_ListAvailableSizes_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetsListAvailableSizesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAvailableSizesPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_ListAvailableSizes_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetsListAvailableSizesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAvailableSizesPager("rgcompute", "aa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go index 614557862118..2d3a2be8c2a8 100644 --- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go @@ -60,7 +60,7 @@ func NewCapacityReservationGroupsClient(subscriptionID string, credential azcore // only tags may be modified. Please refer to https://aka.ms/CapacityReservation for more // details. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // parameters - Parameters supplied to the Create capacity reservation Group. @@ -101,7 +101,7 @@ func (client *CapacityReservationGroupsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -120,7 +120,7 @@ func (client *CapacityReservationGroupsClient) createOrUpdateHandleResponse(resp // are disassociated from the reservation group and all capacity reservations under // the reservation group have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // options - CapacityReservationGroupsClientDeleteOptions contains the optional parameters for the CapacityReservationGroupsClient.Delete @@ -160,7 +160,7 @@ func (client *CapacityReservationGroupsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -168,7 +168,7 @@ func (client *CapacityReservationGroupsClient) deleteCreateRequest(ctx context.C // Get - The operation that retrieves information about a capacity reservation group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // options - CapacityReservationGroupsClientGetOptions contains the optional parameters for the CapacityReservationGroupsClient.Get @@ -211,7 +211,7 @@ func (client *CapacityReservationGroupsClient) getCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +228,7 @@ func (client *CapacityReservationGroupsClient) getHandleResponse(resp *http.Resp // NewListByResourceGroupPager - Lists all of the capacity reservation groups in the specified resource group. Use the nextLink // property in the response to get the next page of capacity reservation groups. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - CapacityReservationGroupsClientListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroupsClient.ListByResourceGroup // method. @@ -276,7 +276,7 @@ func (client *CapacityReservationGroupsClient) listByResourceGroupCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -296,7 +296,7 @@ func (client *CapacityReservationGroupsClient) listByResourceGroupHandleResponse // NewListBySubscriptionPager - Lists all of the capacity reservation groups in the subscription. Use the nextLink property // in the response to get the next page of capacity reservation groups. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - CapacityReservationGroupsClientListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroupsClient.ListBySubscription // method. func (client *CapacityReservationGroupsClient) NewListBySubscriptionPager(options *CapacityReservationGroupsClientListBySubscriptionOptions) *runtime.Pager[CapacityReservationGroupsClientListBySubscriptionResponse] { @@ -339,7 +339,7 @@ func (client *CapacityReservationGroupsClient) listBySubscriptionCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -360,7 +360,7 @@ func (client *CapacityReservationGroupsClient) listBySubscriptionHandleResponse( // Update - The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may // be modified. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // parameters - Parameters supplied to the Update capacity reservation Group operation. @@ -401,7 +401,7 @@ func (client *CapacityReservationGroupsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go deleted file mode 100644 index 641080c70daf..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go +++ /dev/null @@ -1,191 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.json -func ExampleCapacityReservationGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", armcompute.CapacityReservationGroup{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("finance"), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{ - Tags: map[string]*string{ - "key5355": to.Ptr("aaa"), - }, - Properties: &armcompute.CapacityReservationGroupProperties{ - InstanceView: &armcompute.CapacityReservationGroupInstanceView{}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MinimumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "rgcompute", "a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Get.json -func ExampleCapacityReservationGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationGroupsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myCapacityReservationGroup", &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.json -func ExampleCapacityReservationGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", &armcompute.CapacityReservationGroupsClientListByResourceGroupOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.json -func ExampleCapacityReservationGroupsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armcompute.CapacityReservationGroupsClientListBySubscriptionOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go b/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go index ea05c90b1593..22808df261be 100644 --- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go +++ b/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go @@ -60,7 +60,7 @@ func NewCapacityReservationsClient(subscriptionID string, credential azcore.Toke // only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more // details. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // capacityReservationName - The name of the capacity reservation. @@ -83,7 +83,7 @@ func (client *CapacityReservationsClient) BeginCreateOrUpdate(ctx context.Contex // during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more // details. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *CapacityReservationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) if err != nil { @@ -123,7 +123,7 @@ func (client *CapacityReservationsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -133,7 +133,7 @@ func (client *CapacityReservationsClient) createOrUpdateCreateRequest(ctx contex // are disassociated from the capacity reservation. Please refer to // https://aka.ms/CapacityReservation for more details. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // capacityReservationName - The name of the capacity reservation. @@ -155,7 +155,7 @@ func (client *CapacityReservationsClient) BeginDelete(ctx context.Context, resou // are disassociated from the capacity reservation. Please refer to // https://aka.ms/CapacityReservation for more details. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *CapacityReservationsClient) deleteOperation(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) if err != nil { @@ -195,7 +195,7 @@ func (client *CapacityReservationsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +203,7 @@ func (client *CapacityReservationsClient) deleteCreateRequest(ctx context.Contex // Get - The operation that retrieves information about the capacity reservation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // capacityReservationName - The name of the capacity reservation. @@ -251,7 +251,7 @@ func (client *CapacityReservationsClient) getCreateRequest(ctx context.Context, if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +268,7 @@ func (client *CapacityReservationsClient) getHandleResponse(resp *http.Response) // NewListByCapacityReservationGroupPager - Lists all of the capacity reservations in the specified capacity reservation group. // Use the nextLink property in the response to get the next page of capacity reservations. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // options - CapacityReservationsClientListByCapacityReservationGroupOptions contains the optional parameters for the CapacityReservationsClient.ListByCapacityReservationGroup @@ -321,7 +321,7 @@ func (client *CapacityReservationsClient) listByCapacityReservationGroupCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -338,7 +338,7 @@ func (client *CapacityReservationsClient) listByCapacityReservationGroupHandleRe // BeginUpdate - The operation to update a capacity reservation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // capacityReservationGroupName - The name of the capacity reservation group. // capacityReservationName - The name of the capacity reservation. @@ -359,7 +359,7 @@ func (client *CapacityReservationsClient) BeginUpdate(ctx context.Context, resou // Update - The operation to update a capacity reservation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *CapacityReservationsClient) update(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) if err != nil { @@ -399,7 +399,7 @@ func (client *CapacityReservationsClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go b/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go deleted file mode 100644 index 13a9ccf42103..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go +++ /dev/null @@ -1,207 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_CreateOrUpdate.json -func ExampleCapacityReservationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", armcompute.CapacityReservation{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("HR"), - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](4), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json -func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationUpdate{ - Tags: map[string]*string{ - "key4974": to.Ptr("aaaaaaaaaaaaaaaa"), - }, - Properties: &armcompute.CapacityReservationProperties{ - InstanceView: &armcompute.CapacityReservationInstanceView{ - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - UtilizationInfo: &armcompute.CapacityReservationUtilization{}, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](7), - Tier: to.Ptr("aaa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Update_MinimumSet_Gen.json -func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaa", armcompute.CapacityReservationUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json -func ExampleCapacityReservationsClient_BeginDelete_capacityReservationsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json -func ExampleCapacityReservationsClient_BeginDelete_capacityReservationsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaa", "aaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Get.json -func ExampleCapacityReservationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", &armcompute.CapacityReservationsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationInstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json -func ExampleCapacityReservationsClient_NewListByCapacityReservationGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByCapacityReservationGroupPager("myResourceGroup", "myCapacityReservationGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go deleted file mode 100644 index 7943f85b04b5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go +++ /dev/null @@ -1,103 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceOSVersion_Get.json -func ExampleCloudServiceOperatingSystemsClient_GetOSVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceOperatingSystemsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetOSVersion(ctx, "westus2", "WA-GUEST-OS-3.90_202010-02", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceOSVersion_List.json -func ExampleCloudServiceOperatingSystemsClient_NewListOSVersionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceOperatingSystemsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOSVersionsPager("westus2", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceOSFamily_Get.json -func ExampleCloudServiceOperatingSystemsClient_GetOSFamily() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceOperatingSystemsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetOSFamily(ctx, "westus2", "3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceOSFamilies_List.json -func ExampleCloudServiceOperatingSystemsClient_NewListOSFamiliesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceOperatingSystemsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOSFamiliesPager("westus2", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go deleted file mode 100644 index 7888b485ac67..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go +++ /dev/null @@ -1,180 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Delete.json -func ExampleCloudServiceRoleInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Get.json -func ExampleCloudServiceRoleInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Get_InstanceView.json -func ExampleCloudServiceRoleInstancesClient_GetInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetInstanceView(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRolesInstance_List.json -func ExampleCloudServiceRoleInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientListOptions{Expand: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Restart.json -func ExampleCloudServiceRoleInstancesClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Reimage.json -func ExampleCloudServiceRoleInstancesClient_BeginReimage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimage(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Rebuild.json -func ExampleCloudServiceRoleInstancesClient_BeginRebuild() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRebuild(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Get_RemoteDesktopFile.json -func ExampleCloudServiceRoleInstancesClient_GetRemoteDesktopFile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.GetRemoteDesktopFile(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "rgcloudService", "aaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go deleted file mode 100644 index f6d60663d24c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRole_Get.json -func ExampleCloudServiceRolesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRolesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "{role-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRole_List.json -func ExampleCloudServiceRolesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServiceRolesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("ConstosoRG", "{cs-name}", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go deleted file mode 100644 index b8ef72f446f3..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go +++ /dev/null @@ -1,564 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Create_WithMultiRole.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithMultipleRoles() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("contosolb"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("contosofe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - }, - }, - }}, - }, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }, - { - Name: to.Ptr("ContosoBackend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Create_WithSingleRole.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRole() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("myLoadBalancer"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("myfe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"), - }, - }, - }}, - }, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("contosolb"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("contosofe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - }, - }, - }}, - }, - }}, - }, - OSProfile: &armcompute.CloudServiceOsProfile{ - Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - { - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"), - }, - VaultCertificates: []*armcompute.CloudServiceVaultCertificate{ - { - CertificateURL: to.Ptr("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"), - }}, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Create_WithSingleRoleAndRDP.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRoleAndRdpExtension() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - ExtensionProfile: &armcompute.CloudServiceExtensionProfile{ - Extensions: []*armcompute.Extension{ - { - Name: to.Ptr("RDPExtension"), - Properties: &armcompute.CloudServiceExtensionProperties{ - Type: to.Ptr("RDP"), - AutoUpgradeMinorVersion: to.Ptr(false), - ProtectedSettings: "{password}", - Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - Settings: "UserAzure10/22/2021 15:05:45", - TypeHandlerVersion: to.Ptr("1.2"), - }, - }}, - }, - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("contosolb"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("contosofe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - }, - }, - }}, - }, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Update_ToIncludeTags.json -func ExampleCloudServicesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudServiceUpdate{ - Tags: map[string]*string{ - "Documentation": to.Ptr("RestAPI"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Delete.json -func ExampleCloudServicesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Get_WithMultiRoleAndRDP.json -func ExampleCloudServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Get_InstanceViewWithMultiRole.json -func ExampleCloudServicesClient_GetInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetInstanceView(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_List_BySubscription.json -func ExampleCloudServicesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAllPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_List_ByResourceGroup.json -func ExampleCloudServicesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("ConstosoRG", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Start.json -func ExampleCloudServicesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_PowerOff.json -func ExampleCloudServicesClient_BeginPowerOff() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPowerOff(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Restart_ByCloudService.json -func ExampleCloudServicesClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginRestartOptions{Parameters: &armcompute.RoleInstances{ - RoleInstances: []*string{ - to.Ptr("ContosoFrontend_IN_0"), - to.Ptr("ContosoBackend_IN_1")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Reimage_ByCloudService.json -func ExampleCloudServicesClient_BeginReimage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimage(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginReimageOptions{Parameters: &armcompute.RoleInstances{ - RoleInstances: []*string{ - to.Ptr("ContosoFrontend_IN_0"), - to.Ptr("ContosoBackend_IN_1")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Rebuild_ByCloudService.json -func ExampleCloudServicesClient_BeginRebuild() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRebuild(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginRebuildOptions{Parameters: &armcompute.RoleInstances{ - RoleInstances: []*string{ - to.Ptr("ContosoFrontend_IN_0"), - to.Ptr("ContosoBackend_IN_1")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Delete_ByCloudService.json -func ExampleCloudServicesClient_BeginDeleteInstances() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteInstances(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginDeleteInstancesOptions{Parameters: &armcompute.RoleInstances{ - RoleInstances: []*string{ - to.Ptr("ContosoFrontend_IN_0"), - to.Ptr("ContosoBackend_IN_1")}, - }, - }) - 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) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go deleted file mode 100644 index 90b7da994449..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceUpdateDomain_Update.json -func ExampleCloudServicesUpdateDomainClient_BeginWalkUpdateDomain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesUpdateDomainClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginWalkUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, armcompute.UpdateDomain{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceUpdateDomain_Get.json -func ExampleCloudServicesUpdateDomainClient_GetUpdateDomain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesUpdateDomainClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceUpdateDomain_List.json -func ExampleCloudServicesUpdateDomainClient_NewListUpdateDomainsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCloudServicesUpdateDomainClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListUpdateDomainsPager("ConstosoRG", "{cs-name}", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go deleted file mode 100644 index f5fb36c8db2f..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGallery_Get.json -func ExampleCommunityGalleriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCommunityGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myLocation", "publicGalleryName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go deleted file mode 100644 index 990f08bfdecd..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImage_Get.json -func ExampleCommunityGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCommunityGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImage_List.json -func ExampleCommunityGalleryImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCommunityGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myLocation", "publicGalleryName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go deleted file mode 100644 index b2aca138c9fb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_Get.json -func ExampleCommunityGalleryImageVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCommunityGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_List.json -func ExampleCommunityGalleryImageVersionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewCommunityGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myLocation", "publicGalleryName", "myGalleryImageName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/constants.go b/sdk/resourcemanager/compute/armcompute/constants.go index df1e6e5bb565..c40c3054abc1 100644 --- a/sdk/resourcemanager/compute/armcompute/constants.go +++ b/sdk/resourcemanager/compute/armcompute/constants.go @@ -11,7 +11,7 @@ package armcompute const ( moduleName = "armcompute" - moduleVersion = "v4.0.0" + moduleVersion = "v4.0.1" ) type AccessLevel string diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go index 113ed3eef7a6..51a0016f7c52 100644 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go @@ -59,7 +59,7 @@ func NewDedicatedHostGroupsClient(subscriptionID string, credential azcore.Token // CreateOrUpdate - Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please // see Dedicated Host Documentation [https://go.microsoft.com/fwlink/?linkid=2082596] // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // parameters - Parameters supplied to the Create Dedicated Host Group. @@ -100,7 +100,7 @@ func (client *DedicatedHostGroupsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -117,7 +117,7 @@ func (client *DedicatedHostGroupsClient) createOrUpdateHandleResponse(resp *http // Delete - Delete a dedicated host group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // options - DedicatedHostGroupsClientDeleteOptions contains the optional parameters for the DedicatedHostGroupsClient.Delete @@ -157,7 +157,7 @@ func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -165,7 +165,7 @@ func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context // Get - Retrieves information about a dedicated host group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // options - DedicatedHostGroupsClientGetOptions contains the optional parameters for the DedicatedHostGroupsClient.Get method. @@ -207,7 +207,7 @@ func (client *DedicatedHostGroupsClient) getCreateRequest(ctx context.Context, r if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -224,7 +224,7 @@ func (client *DedicatedHostGroupsClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Lists all of the dedicated host groups in the specified resource group. Use the nextLink // property in the response to get the next page of dedicated host groups. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - DedicatedHostGroupsClientListByResourceGroupOptions contains the optional parameters for the DedicatedHostGroupsClient.ListByResourceGroup // method. @@ -272,7 +272,7 @@ func (client *DedicatedHostGroupsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -289,7 +289,7 @@ func (client *DedicatedHostGroupsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Lists all of the dedicated host groups in the subscription. Use the nextLink property in the // response to get the next page of dedicated host groups. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.ListBySubscription // method. func (client *DedicatedHostGroupsClient) NewListBySubscriptionPager(options *DedicatedHostGroupsClientListBySubscriptionOptions) *runtime.Pager[DedicatedHostGroupsClientListBySubscriptionResponse] { @@ -332,7 +332,7 @@ func (client *DedicatedHostGroupsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +349,7 @@ func (client *DedicatedHostGroupsClient) listBySubscriptionHandleResponse(resp * // Update - Update an dedicated host group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // parameters - Parameters supplied to the Update Dedicated Host Group operation. @@ -390,7 +390,7 @@ func (client *DedicatedHostGroupsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go deleted file mode 100644 index b4244e223741..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go +++ /dev/null @@ -1,319 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.json -func ExampleDedicatedHostGroupsClient_CreateOrUpdate_createOrUpdateADedicatedHostGroupWithUltraSsdSupport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", armcompute.DedicatedHostGroup{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("finance"), - }, - Properties: &armcompute.DedicatedHostGroupProperties{ - AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{ - UltraSSDEnabled: to.Ptr(true), - }, - PlatformFaultDomainCount: to.Ptr[int32](3), - SupportAutomaticPlacement: to.Ptr(true), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.json -func ExampleDedicatedHostGroupsClient_CreateOrUpdate_createOrUpdateADedicatedHostGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", armcompute.DedicatedHostGroup{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("finance"), - }, - Properties: &armcompute.DedicatedHostGroupProperties{ - PlatformFaultDomainCount: to.Ptr[int32](3), - SupportAutomaticPlacement: to.Ptr(true), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_Update_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaa", armcompute.DedicatedHostGroupUpdate{ - Tags: map[string]*string{ - "key9921": to.Ptr("aaaaaaaaaa"), - }, - Properties: &armcompute.DedicatedHostGroupProperties{ - InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - { - AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - { - Count: to.Ptr[float64](26), - VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - }}, - }, - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - }}, - }, - PlatformFaultDomainCount: to.Ptr[int32](3), - SupportAutomaticPlacement: to.Ptr(true), - }, - Zones: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_Update_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.DedicatedHostGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_Delete_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "rgcompute", "a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_Delete_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "rgcompute", "aaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get.json -func ExampleDedicatedHostGroupsClient_Get_createADedicatedHostGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json -func ExampleDedicatedHostGroupsClient_Get_createAnUltraSsdEnabledDedicatedHostGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListByResourceGroup_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupsListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListByResourceGroup_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupsListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListBySubscription_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupsListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListBySubscription_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupsListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go index f420efbf6e9c..19e2d77d452b 100644 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go +++ b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go @@ -58,7 +58,7 @@ func NewDedicatedHostsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateOrUpdate - Create or update a dedicated host . // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // hostName - The name of the dedicated host . @@ -79,7 +79,7 @@ func (client *DedicatedHostsClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Create or update a dedicated host . // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *DedicatedHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) if err != nil { @@ -119,7 +119,7 @@ func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -127,7 +127,7 @@ func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Cont // BeginDelete - Delete a dedicated host. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // hostName - The name of the dedicated host. @@ -147,7 +147,7 @@ func (client *DedicatedHostsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete a dedicated host. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *DedicatedHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) if err != nil { @@ -187,7 +187,7 @@ func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +195,7 @@ func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, res // Get - Retrieves information about a dedicated host. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // hostName - The name of the dedicated host. @@ -242,7 +242,7 @@ func (client *DedicatedHostsClient) getCreateRequest(ctx context.Context, resour if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +259,7 @@ func (client *DedicatedHostsClient) getHandleResponse(resp *http.Response) (Dedi // NewListByHostGroupPager - Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property // in the response to get the next page of dedicated hosts. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // options - DedicatedHostsClientListByHostGroupOptions contains the optional parameters for the DedicatedHostsClient.ListByHostGroup @@ -312,7 +312,7 @@ func (client *DedicatedHostsClient) listByHostGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,7 +332,7 @@ func (client *DedicatedHostsClient) listByHostGroupHandleResponse(resp *http.Res // restart check the Resource Health Center in the Azure Portal. Please refer to https://docs.microsoft.com/azure/service-health/resource-health-overview // for more details. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // hostName - The name of the dedicated host. @@ -355,7 +355,7 @@ func (client *DedicatedHostsClient) BeginRestart(ctx context.Context, resourceGr // restart check the Resource Health Center in the Azure Portal. Please refer to https://docs.microsoft.com/azure/service-health/resource-health-overview // for more details. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *DedicatedHostsClient) restart(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) if err != nil { @@ -395,7 +395,7 @@ func (client *DedicatedHostsClient) restartCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -403,7 +403,7 @@ func (client *DedicatedHostsClient) restartCreateRequest(ctx context.Context, re // BeginUpdate - Update an dedicated host . // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // hostGroupName - The name of the dedicated host group. // hostName - The name of the dedicated host . @@ -424,7 +424,7 @@ func (client *DedicatedHostsClient) BeginUpdate(ctx context.Context, resourceGro // Update - Update an dedicated host . // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *DedicatedHostsClient) update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) if err != nil { @@ -464,7 +464,7 @@ func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go deleted file mode 100644 index 44aa53e7e447..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go +++ /dev/null @@ -1,256 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.json -func ExampleDedicatedHostsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", "myDedicatedHost", armcompute.DedicatedHost{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("HR"), - }, - Properties: &armcompute.DedicatedHostProperties{ - PlatformFaultDomain: to.Ptr[int32](1), - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("DSv3-Type1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_Update_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{ - Tags: map[string]*string{ - "key8813": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }, - Properties: &armcompute.DedicatedHostProperties{ - AutoReplaceOnFailure: to.Ptr(true), - InstanceView: &armcompute.DedicatedHostInstanceView{ - AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - { - Count: to.Ptr[float64](26), - VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - }}, - }, - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - }, - LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid), - PlatformFaultDomain: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_Update_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_Delete_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaa", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_Delete_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaa", "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHost_Get.json -func ExampleDedicatedHostsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", &armcompute.DedicatedHostsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_ListByHostGroup_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostsListByHostGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByHostGroupPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_ListByHostGroup_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostsListByHostGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByHostGroupPager("rgcompute", "aaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHost_Restart.json -func ExampleDedicatedHostsClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", nil) - 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) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go deleted file mode 100644 index c69b0098b9c7..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go +++ /dev/null @@ -1,291 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Create.json -func ExampleDiskAccessesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskAccess", armcompute.DiskAccess{ - Location: to.Ptr("West US"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Update.json -func ExampleDiskAccessesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDiskAccess", armcompute.DiskAccessUpdate{ - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("PrivateEndpoints"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json -func ExampleDiskAccessesClient_Get_getInformationAboutADiskAccessResourceWithPrivateEndpoints() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Get.json -func ExampleDiskAccessesClient_Get_getInformationAboutADiskAccessResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Delete.json -func ExampleDiskAccessesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_ListByResourceGroup.json -func ExampleDiskAccessesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_ListBySubscription.json -func ExampleDiskAccessesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json -func ExampleDiskAccessesClient_GetPrivateLinkResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetPrivateLinkResources(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json -func ExampleDiskAccessesClient_BeginUpdateAPrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", armcompute.PrivateEndpointConnection{ - Properties: &armcompute.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approving myPrivateEndpointConnection"), - Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json -func ExampleDiskAccessesClient_GetAPrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json -func ExampleDiskAccessesClient_BeginDeleteAPrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json -func ExampleDiskAccessesClient_NewListPrivateEndpointConnectionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPrivateEndpointConnectionsPager("myResourceGroup", "myDiskAccess", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go deleted file mode 100644 index dc4beca79219..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go +++ /dev/null @@ -1,363 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json -func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSetWithKeyVaultFromADifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{ - Location: to.Ptr("West US"), - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - }, - Properties: &armcompute.EncryptionSetProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}"), - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json -func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSetWithKeyVaultFromADifferentTenant() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{ - Location: to.Ptr("West US"), - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": {}, - }, - }, - Properties: &armcompute.EncryptionSetProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}"), - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - FederatedClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create.json -func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{ - Location: to.Ptr("West US"), - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - }, - Properties: &armcompute.EncryptionSetProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - SourceVault: &armcompute.SourceVault{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - }, - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json -func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{ - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - }, - Properties: &armcompute.DiskEncryptionSetUpdateProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"), - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - RotationToLatestKeyVersionEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json -func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{ - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - }, - Properties: &armcompute.DiskEncryptionSetUpdateProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"), - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - RotationToLatestKeyVersionEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update.json -func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{ - Properties: &armcompute.DiskEncryptionSetUpdateProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion"), - SourceVault: &armcompute.SourceVault{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - }, - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - }, - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("Encryption"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json -func ExampleDiskEncryptionSetsClient_Get_getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get.json -func ExampleDiskEncryptionSetsClient_Get_getInformationAboutADiskEncryptionSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json -func ExampleDiskEncryptionSetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json -func ExampleDiskEncryptionSetsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json -func ExampleDiskEncryptionSetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json -func ExampleDiskEncryptionSetsClient_NewListAssociatedResourcesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAssociatedResourcesPager("myResourceGroup", "myDiskEncryptionSet", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go deleted file mode 100644 index b3958965ebaa..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go +++ /dev/null @@ -1,127 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_Get.json -func ExampleDiskRestorePointClient_Get_getAnIncrementalDiskRestorePointResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json -func ExampleDiskRestorePointClient_Get_getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json -func ExampleDiskRestorePointClient_NewListByRestorePointPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByRestorePointPager("myResourceGroup", "rpc", "vmrp", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json -func ExampleDiskRestorePointClient_BeginGrantAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginGrantAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json -func ExampleDiskRestorePointClient_BeginRevokeAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRevokeAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - 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) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go b/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go deleted file mode 100644 index 99c6c4315a05..000000000000 --- a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go +++ /dev/null @@ -1,1274 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json -func ExampleDisksClient_BeginCreateOrUpdate_createAConfidentialVmSupportedDiskEncryptedWithCustomerManagedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - ImageReference: &armcompute.ImageDiskReference{ - ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - SecurityProfile: &armcompute.DiskSecurityProfile{ - SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), - SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDiskAccess.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskAndAssociateWithDiskAccessResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskAccessID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"), - DiskSizeGB: to.Ptr[int32](200), - NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowPrivate), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDiskEncryptionSet.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskAndAssociateWithDiskEncryptionSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - Encryption: &armcompute.Encryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByCopyingASnapshot.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByCopyingASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromImportSecure.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromImportSecureCreateOption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure), - SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - SecurityProfile: &armcompute.DiskSecurityProfile{ - SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromUploadPreparedSecure.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromUploadPreparedSecureCreateOption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionUploadPreparedSecure), - UploadSizeBytes: to.Ptr[int64](10737418752), - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - SecurityProfile: &armcompute.DiskSecurityProfile{ - SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAPlatformImage.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAPlatformImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - ImageReference: &armcompute.ImageDiskReference{ - ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryCommunityImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - GalleryImageReference: &armcompute.ImageDiskReference{ - CommunityGalleryImageID: to.Ptr("/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - GalleryImageReference: &armcompute.ImageDiskReference{ - SharedGalleryImageID: to.Ptr("/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - GalleryImageReference: &armcompute.ImageDiskReference{ - ID: to.Ptr("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnExistingManagedDisk.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk2", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDataAccessAuthMode.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithDataAccessAuthMode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DataAccessAuthMode: to.Ptr(armcompute.DataAccessAuthModeAzureActiveDirectory), - DiskSizeGB: to.Ptr[int32](200), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithOptimizedForFrequentAttach() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - OptimizedForFrequentAttach: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_PerformancePlus.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithPerformancePlus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - PerformancePlus: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithPremiumV2AccountType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myPremiumV2Disk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskIOPSReadWrite: to.Ptr[int64](125), - DiskMBpsReadWrite: to.Ptr[int64](3000), - DiskSizeGB: to.Ptr[int32](200), - }, - SKU: &armcompute.DiskSKU{ - Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithSecurityProfile.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithSecurityProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("North Central US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - ImageReference: &armcompute.ImageDiskReference{ - ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - SecurityProfile: &armcompute.DiskSecurityProfile{ - SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithSSDZRSAccountType.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithSsdZrsAccountType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - SKU: &armcompute.DiskSKU{ - Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myUltraReadOnlyDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - LogicalSectorSize: to.Ptr[int32](4096), - }, - DiskIOPSReadWrite: to.Ptr[int64](125), - DiskMBpsReadWrite: to.Ptr[int64](3000), - DiskSizeGB: to.Ptr[int32](200), - Encryption: &armcompute.Encryption{ - Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - }, - }, - SKU: &armcompute.DiskSKU{ - Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_UploadDisk.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedUploadDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - UploadSizeBytes: to.Ptr[int64](10737418752), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_InExtendedLocation.json -func ExampleDisksClient_BeginCreateOrUpdate_createAnEmptyManagedDiskInExtendedLocation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - ExtendedLocation: &armcompute.ExtendedLocation{ - Name: to.Ptr("{edge-zone-id}"), - Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - }, - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_Empty.json -func ExampleDisksClient_BeginCreateOrUpdate_createAnEmptyManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithLogicalSectorSize.json -func ExampleDisksClient_BeginCreateOrUpdate_createAnUltraManagedDiskWithLogicalSectorSize512E() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - LogicalSectorSize: to.Ptr[int32](512), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - SKU: &armcompute.DiskSKU{ - Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json -func ExampleDisksClient_BeginUpdate_createOrUpdateABurstingEnabledManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - BurstingEnabled: to.Ptr(true), - DiskSizeGB: to.Ptr[int32](1024), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddAcceleratedNetworking() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - SupportedCapabilities: &armcompute.SupportedCapabilities{ - AcceleratedNetwork: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_ToAddArchitecture.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddArchitecture() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - SupportedCapabilities: &armcompute.SupportedCapabilities{ - Architecture: to.Ptr(armcompute.ArchitectureArm64), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddPurchasePlan.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddPurchasePlan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - PurchasePlan: &armcompute.DiskPurchasePlan{ - Name: to.Ptr("myPurchasePlanName"), - Product: to.Ptr("myPurchasePlanProduct"), - PromotionCode: to.Ptr("myPurchasePlanPromotionCode"), - Publisher: to.Ptr("myPurchasePlanPublisher"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddSupportsHibernation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - SupportsHibernation: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_ChangeTier.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToChangeTier() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - Tier: to.Ptr("P30"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_DisableBursting.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToDisableBursting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - BurstingEnabled: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToDisableOptimizedForFrequentAttach() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - OptimizedForFrequentAttach: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskWithDiskControllerTypes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - SupportedCapabilities: &armcompute.SupportedCapabilities{ - DiskControllerTypes: to.Ptr("SCSI"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.json -func ExampleDisksClient_BeginUpdate_updateManagedDiskToRemoveDiskAccessResourceAssociation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Get.json -func ExampleDisksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myManagedDisk", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Delete.json -func ExampleDisksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myDisk", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_ListByResourceGroup.json -func ExampleDisksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_ListBySubscription.json -func ExampleDisksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_BeginGetAccess.json -func ExampleDisksClient_BeginGrantAccess_getASasOnAManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json -func ExampleDisksClient_BeginGrantAccess_getSasOnManagedDiskAndVmGuestState() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - GetSecureVMGuestStateSAS: to.Ptr(true), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_EndGetAccess.json -func ExampleDisksClient_BeginRevokeAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRevokeAccess(ctx, "myResourceGroup", "myDisk", nil) - 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) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go deleted file mode 100644 index fbb1d45559dd..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go +++ /dev/null @@ -1,325 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/CommunityGallery_Create.json -func ExampleGalleriesClient_BeginCreateOrUpdate_createACommunityGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - SharingProfile: &armcompute.SharingProfile{ - CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{ - Eula: to.Ptr("eula"), - PublicNamePrefix: to.Ptr("PirPublic"), - PublisherContact: to.Ptr("pir@microsoft.com"), - PublisherURI: to.Ptr("uri"), - }, - Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.json -func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryWithSharingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - SharingProfile: &armcompute.SharingProfile{ - Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.json -func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryWithSoftDeletionEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - SoftDeletePolicy: &armcompute.SoftDeletePolicy{ - IsSoftDeleteEnabled: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create.json -func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Update.json -func ExampleGalleriesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.GalleryUpdate{ - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/CommunityGallery_Get.json -func ExampleGalleriesClient_Get_getACommunityGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json -func ExampleGalleriesClient_Get_getAGalleryWithExpandSharingProfileGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: to.Ptr(armcompute.GalleryExpandParamsSharingProfileGroups), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json -func ExampleGalleriesClient_Get_getAGalleryWithSelectPermissions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: to.Ptr(armcompute.SelectPermissionsPermissions), - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get.json -func ExampleGalleriesClient_Get_getAGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Delete.json -func ExampleGalleriesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ListByResourceGroup.json -func ExampleGalleriesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ListBySubscription.json -func ExampleGalleriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go deleted file mode 100644 index f3e1324c70d2..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go +++ /dev/null @@ -1,173 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Create.json -func ExampleGalleryApplicationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplication{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryApplicationProperties{ - Description: to.Ptr("This is the gallery application description."), - CustomActions: []*armcompute.GalleryApplicationCustomAction{ - { - Name: to.Ptr("myCustomAction"), - Description: to.Ptr("This is the custom action description."), - Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - { - Name: to.Ptr("myCustomActionParameter"), - Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - Description: to.Ptr("This is the description of the parameter"), - DefaultValue: to.Ptr("default value of parameter."), - Required: to.Ptr(false), - }}, - Script: to.Ptr("myCustomActionScript"), - }}, - Eula: to.Ptr("This is the gallery application EULA."), - PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"), - ReleaseNoteURI: to.Ptr("myReleaseNoteUri"), - SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Update.json -func ExampleGalleryApplicationsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplicationUpdate{ - Properties: &armcompute.GalleryApplicationProperties{ - Description: to.Ptr("This is the gallery application description."), - CustomActions: []*armcompute.GalleryApplicationCustomAction{ - { - Name: to.Ptr("myCustomAction"), - Description: to.Ptr("This is the custom action description."), - Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - { - Name: to.Ptr("myCustomActionParameter"), - Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - Description: to.Ptr("This is the description of the parameter"), - DefaultValue: to.Ptr("default value of parameter."), - Required: to.Ptr(false), - }}, - Script: to.Ptr("myCustomActionScript"), - }}, - Eula: to.Ptr("This is the gallery application EULA."), - PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"), - ReleaseNoteURI: to.Ptr("myReleaseNoteUri"), - SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Get.json -func ExampleGalleryApplicationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Delete.json -func ExampleGalleryApplicationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_ListByGallery.json -func ExampleGalleryApplicationsClient_NewListByGalleryPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByGalleryPager("myResourceGroup", "myGalleryName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go deleted file mode 100644 index 8871c5b314bf..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go +++ /dev/null @@ -1,214 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Create.json -func ExampleGalleryApplicationVersionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", armcompute.GalleryApplicationVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryApplicationVersionProperties{ - PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00Z"); return t }()), - ReplicaCount: to.Ptr[int32](1), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - }}, - CustomActions: []*armcompute.GalleryApplicationCustomAction{ - { - Name: to.Ptr("myCustomAction"), - Description: to.Ptr("This is the custom action description."), - Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - { - Name: to.Ptr("myCustomActionParameter"), - Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - Description: to.Ptr("This is the description of the parameter"), - DefaultValue: to.Ptr("default value of parameter."), - Required: to.Ptr(false), - }}, - Script: to.Ptr("myCustomActionScript"), - }}, - ManageActions: &armcompute.UserArtifactManage{ - Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - Remove: to.Ptr("del C:\\package "), - }, - Source: &armcompute.UserArtifactSource{ - MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - }, - }, - SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Update.json -func ExampleGalleryApplicationVersionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", armcompute.GalleryApplicationVersionUpdate{ - Properties: &armcompute.GalleryApplicationVersionProperties{ - PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00Z"); return t }()), - ReplicaCount: to.Ptr[int32](1), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - }}, - ManageActions: &armcompute.UserArtifactManage{ - Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - Remove: to.Ptr("del C:\\package "), - }, - Source: &armcompute.UserArtifactSource{ - MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - }, - }, - SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json -func ExampleGalleryApplicationVersionsClient_Get_getAGalleryApplicationVersionWithReplicationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypesReplicationStatus)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Get.json -func ExampleGalleryApplicationVersionsClient_Get_getAGalleryApplicationVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Delete.json -func ExampleGalleryApplicationVersionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json -func ExampleGalleryApplicationVersionsClient_NewListByGalleryApplicationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByGalleryApplicationPager("myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go deleted file mode 100644 index a2e17d9abfc5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go +++ /dev/null @@ -1,151 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Create.json -func ExampleGalleryImagesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImage{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageProperties{ - HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - Identifier: &armcompute.GalleryImageIdentifier{ - Offer: to.Ptr("myOfferName"), - Publisher: to.Ptr("myPublisherName"), - SKU: to.Ptr("mySkuName"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Update.json -func ExampleGalleryImagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImageUpdate{ - Properties: &armcompute.GalleryImageProperties{ - HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - Identifier: &armcompute.GalleryImageIdentifier{ - Offer: to.Ptr("myOfferName"), - Publisher: to.Ptr("myPublisherName"), - SKU: to.Ptr("mySkuName"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Get.json -func ExampleGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Delete.json -func ExampleGalleryImagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_ListByGallery.json -func ExampleGalleryImagesClient_NewListByGalleryPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByGalleryPager("myResourceGroup", "myGalleryName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go deleted file mode 100644 index 47b900acc7e6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go +++ /dev/null @@ -1,802 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVmAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingCommunityGalleryImageAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingMixOfDisksAndSnapshotsAsASource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - DataDiskImages: []*armcompute.GalleryDataDiskImage{ - { - HostCaching: to.Ptr(armcompute.HostCachingNone), - Source: &armcompute.GalleryDiskImageSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"), - }, - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.GalleryOSDiskImage{ - HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - Source: &armcompute.GalleryDiskImageSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow), - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - DataDiskImages: []*armcompute.GalleryDataDiskImage{ - { - HostCaching: to.Ptr(armcompute.HostCachingNone), - Source: &armcompute.GalleryDiskImageSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"), - URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"), - }, - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.GalleryOSDiskImage{ - HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - Source: &armcompute.GalleryDiskImageSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"), - URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionWithTargetExtendedLocationsSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Update.json -func ExampleGalleryImageVersionsClient_BeginUpdate_updateASimpleGalleryImageVersionManagedImageAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{ - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.json -func ExampleGalleryImageVersionsClient_BeginUpdate_updateASimpleGalleryImageVersionWithoutSourceId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{ - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json -func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithReplicationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypesReplicationStatus)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json -func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithSnapshotsAsASource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json -func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithVhdAsASource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get.json -func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Delete.json -func ExampleGalleryImageVersionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_ListByGalleryImage.json -func ExampleGalleryImageVersionsClient_NewListByGalleryImagePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByGalleryImagePager("myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go b/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go deleted file mode 100644 index 0f70108686f1..000000000000 --- a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go +++ /dev/null @@ -1,105 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_AddToSharingProfile.json -func ExampleGallerySharingProfileClient_BeginUpdate_addSharingIdToTheSharingProfileOfAGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGallerySharingProfileClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{ - Groups: []*armcompute.SharingProfileGroup{ - { - Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions), - IDs: []*string{ - to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"), - to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")}, - }, - { - Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants), - IDs: []*string{ - to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")}, - }}, - OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesAdd), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ResetSharingProfile.json -func ExampleGallerySharingProfileClient_BeginUpdate_resetSharingProfileOfAGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGallerySharingProfileClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{ - OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesReset), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_EnableCommunityGallery.json -func ExampleGallerySharingProfileClient_BeginUpdate_shareAGalleryToCommunity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewGallerySharingProfileClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{ - OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesEnableCommunity), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/go.mod b/sdk/resourcemanager/compute/armcompute/go.mod index 5f5224d85d78..fc8aa9eb99b6 100644 --- a/sdk/resourcemanager/compute/armcompute/go.mod +++ b/sdk/resourcemanager/compute/armcompute/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3 v3.0.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.0.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // 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.4.0 // indirect diff --git a/sdk/resourcemanager/compute/armcompute/images_client.go b/sdk/resourcemanager/compute/armcompute/images_client.go index ea18f9885da8..a4f12f495265 100644 --- a/sdk/resourcemanager/compute/armcompute/images_client.go +++ b/sdk/resourcemanager/compute/armcompute/images_client.go @@ -58,7 +58,7 @@ func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Create or update an image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // imageName - The name of the image. // parameters - Parameters supplied to the Create Image operation. @@ -78,7 +78,7 @@ func (client *ImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Create or update an image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) if err != nil { @@ -114,7 +114,7 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,7 +122,7 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Deletes an Image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // imageName - The name of the image. // options - ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method. @@ -140,7 +140,7 @@ func (client *ImagesClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deletes an Image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, imageName, options) if err != nil { @@ -176,7 +176,7 @@ func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +184,7 @@ func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets an image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // imageName - The name of the image. // options - ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. @@ -226,7 +226,7 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,7 +243,7 @@ func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesClient // NewListPager - Gets the list of Images in the subscription. Use nextLink property in the response to get the next page // of Images. Do this till nextLink is null to fetch all the Images. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - ImagesClientListOptions contains the optional parameters for the ImagesClient.List method. func (client *ImagesClient) NewListPager(options *ImagesClientListOptions) *runtime.Pager[ImagesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ImagesClientListResponse]{ @@ -285,7 +285,7 @@ func (client *ImagesClient) listCreateRequest(ctx context.Context, options *Imag return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,7 +301,7 @@ func (client *ImagesClient) listHandleResponse(resp *http.Response) (ImagesClien } // NewListByResourceGroupPager - Gets the list of images under a resource group. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - ImagesClientListByResourceGroupOptions contains the optional parameters for the ImagesClient.ListByResourceGroup // method. @@ -349,7 +349,7 @@ func (client *ImagesClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,7 +366,7 @@ func (client *ImagesClient) listByResourceGroupHandleResponse(resp *http.Respons // BeginUpdate - Update an image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // imageName - The name of the image. // parameters - Parameters supplied to the Update Image operation. @@ -385,7 +385,7 @@ func (client *ImagesClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Update an image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *ImagesClient) update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) if err != nil { @@ -421,7 +421,7 @@ func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/images_client_example_test.go b/sdk/resourcemanager/compute/armcompute/images_client_example_test.go deleted file mode 100644 index 0895afc19ba2..000000000000 --- a/sdk/resourcemanager/compute/armcompute/images_client_example_test.go +++ /dev/null @@ -1,542 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromABlob.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromABlob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - Snapshot: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromAManagedDisk.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - ManagedDisk: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - ManagedDisk: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromASnapshot.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - Snapshot: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromAVM.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAnExistingVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - SourceVirtualMachine: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Create_DataDiskFromABlobIncluded.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromABlob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - DataDisks: []*armcompute.ImageDataDisk{ - { - BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - Lun: to.Ptr[int32](1), - }}, - OSDisk: &armcompute.ImageOSDisk{ - BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - DataDisks: []*armcompute.ImageDataDisk{ - { - ManagedDisk: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - }, - Lun: to.Ptr[int32](1), - }}, - OSDisk: &armcompute.ImageOSDisk{ - ManagedDisk: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - DataDisks: []*armcompute.ImageDataDisk{ - { - Snapshot: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - }, - Lun: to.Ptr[int32](1), - }}, - OSDisk: &armcompute.ImageOSDisk{ - Snapshot: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Update.json -func ExampleImagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myImage", armcompute.ImageUpdate{ - Tags: map[string]*string{ - "department": to.Ptr("HR"), - }, - Properties: &armcompute.ImageProperties{ - HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1), - SourceVirtualMachine: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Images_Delete_MaximumSet_Gen.json -func ExampleImagesClient_BeginDelete_imagesDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Images_Delete_MinimumSet_Gen.json -func ExampleImagesClient_BeginDelete_imagesDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Get.json -func ExampleImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myImage", &armcompute.ImagesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_ListByResourceGroup.json -func ExampleImagesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_ListBySubscription.json -func ExampleImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/loganalytics_client.go b/sdk/resourcemanager/compute/armcompute/loganalytics_client.go index 51c8611dd758..7fb9382811d3 100644 --- a/sdk/resourcemanager/compute/armcompute/loganalytics_client.go +++ b/sdk/resourcemanager/compute/armcompute/loganalytics_client.go @@ -59,7 +59,7 @@ func NewLogAnalyticsClient(subscriptionID string, credential azcore.TokenCredent // BeginExportRequestRateByInterval - Export logs that show Api requests made by this subscription in the given time window // to show throttling activities. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The location upon which virtual-machine-sizes is queried. // parameters - Parameters supplied to the LogAnalytics getRequestRateByInterval Api. // options - LogAnalyticsClientBeginExportRequestRateByIntervalOptions contains the optional parameters for the LogAnalyticsClient.BeginExportRequestRateByInterval @@ -81,7 +81,7 @@ func (client *LogAnalyticsClient) BeginExportRequestRateByInterval(ctx context.C // ExportRequestRateByInterval - Export logs that show Api requests made by this subscription in the given time window to // show throttling activities. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *LogAnalyticsClient) exportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsClientBeginExportRequestRateByIntervalOptions) (*http.Response, error) { req, err := client.exportRequestRateByIntervalCreateRequest(ctx, location, parameters, options) if err != nil { @@ -113,7 +113,7 @@ func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,7 +122,7 @@ func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx c // BeginExportThrottledRequests - Export logs that show total throttled Api requests for this subscription in the given time // window. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The location upon which virtual-machine-sizes is queried. // parameters - Parameters supplied to the LogAnalytics getThrottledRequests Api. // options - LogAnalyticsClientBeginExportThrottledRequestsOptions contains the optional parameters for the LogAnalyticsClient.BeginExportThrottledRequests @@ -143,7 +143,7 @@ func (client *LogAnalyticsClient) BeginExportThrottledRequests(ctx context.Conte // ExportThrottledRequests - Export logs that show total throttled Api requests for this subscription in the given time window. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *LogAnalyticsClient) exportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsClientBeginExportThrottledRequestsOptions) (*http.Response, error) { req, err := client.exportThrottledRequestsCreateRequest(ctx, location, parameters, options) if err != nil { @@ -175,7 +175,7 @@ func (client *LogAnalyticsClient) exportThrottledRequestsCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go b/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go deleted file mode 100644 index cc2d90cf15eb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go +++ /dev/null @@ -1,80 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json -func ExampleLogAnalyticsClient_BeginExportRequestRateByInterval() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewLogAnalyticsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginExportRequestRateByInterval(ctx, "westus", armcompute.RequestRateByIntervalInput{ - BlobContainerSasURI: to.Ptr("https://somesasuri"), - FromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-21T01:54:06.862601Z"); return t }()), - GroupByResourceName: to.Ptr(true), - ToTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862601Z"); return t }()), - IntervalLength: to.Ptr(armcompute.IntervalInMinsFiveMins), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/logAnalyticExamples/LogAnalytics_ThrottledRequests.json -func ExampleLogAnalyticsClient_BeginExportThrottledRequests() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewLogAnalyticsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginExportThrottledRequests(ctx, "westus", armcompute.ThrottledRequestsInput{ - BlobContainerSasURI: to.Ptr("https://somesasuri"), - FromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-21T01:54:06.862601Z"); return t }()), - GroupByClientApplicationID: to.Ptr(false), - GroupByOperationName: to.Ptr(true), - GroupByResourceName: to.Ptr(false), - GroupByUserAgent: to.Ptr(false), - ToTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862601Z"); return t }()), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/operations_client.go b/sdk/resourcemanager/compute/armcompute/operations_client.go index 1810c404d7b5..35cadd27b91b 100644 --- a/sdk/resourcemanager/compute/armcompute/operations_client.go +++ b/sdk/resourcemanager/compute/armcompute/operations_client.go @@ -50,7 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Gets a list of compute operations. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -82,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go b/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go deleted file mode 100644 index 77779f8ec238..000000000000 --- a/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go index 40c0d2177e06..bbd223b975af 100644 --- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go @@ -58,7 +58,7 @@ func NewProximityPlacementGroupsClient(subscriptionID string, credential azcore. // CreateOrUpdate - Create or update a proximity placement group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // proximityPlacementGroupName - The name of the proximity placement group. // parameters - Parameters supplied to the Create Proximity Placement Group operation. @@ -99,7 +99,7 @@ func (client *ProximityPlacementGroupsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -116,7 +116,7 @@ func (client *ProximityPlacementGroupsClient) createOrUpdateHandleResponse(resp // Delete - Delete a proximity placement group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // proximityPlacementGroupName - The name of the proximity placement group. // options - ProximityPlacementGroupsClientDeleteOptions contains the optional parameters for the ProximityPlacementGroupsClient.Delete @@ -156,7 +156,7 @@ func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -164,7 +164,7 @@ func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Co // Get - Retrieves information about a proximity placement group . // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // proximityPlacementGroupName - The name of the proximity placement group. // options - ProximityPlacementGroupsClientGetOptions contains the optional parameters for the ProximityPlacementGroupsClient.Get @@ -207,7 +207,7 @@ func (client *ProximityPlacementGroupsClient) getCreateRequest(ctx context.Conte if options != nil && options.IncludeColocationStatus != nil { reqQP.Set("includeColocationStatus", *options.IncludeColocationStatus) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -223,7 +223,7 @@ func (client *ProximityPlacementGroupsClient) getHandleResponse(resp *http.Respo } // NewListByResourceGroupPager - Lists all proximity placement groups in a resource group. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - ProximityPlacementGroupsClientListByResourceGroupOptions contains the optional parameters for the ProximityPlacementGroupsClient.ListByResourceGroup // method. @@ -271,7 +271,7 @@ func (client *ProximityPlacementGroupsClient) listByResourceGroupCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,7 +287,7 @@ func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleResponse( } // NewListBySubscriptionPager - Lists all proximity placement groups in a subscription. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - ProximityPlacementGroupsClientListBySubscriptionOptions contains the optional parameters for the ProximityPlacementGroupsClient.ListBySubscription // method. func (client *ProximityPlacementGroupsClient) NewListBySubscriptionPager(options *ProximityPlacementGroupsClientListBySubscriptionOptions) *runtime.Pager[ProximityPlacementGroupsClientListBySubscriptionResponse] { @@ -330,7 +330,7 @@ func (client *ProximityPlacementGroupsClient) listBySubscriptionCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,7 +347,7 @@ func (client *ProximityPlacementGroupsClient) listBySubscriptionHandleResponse(r // Update - Update a proximity placement group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // proximityPlacementGroupName - The name of the proximity placement group. // parameters - Parameters supplied to the Update Proximity Placement Group operation. @@ -388,7 +388,7 @@ func (client *ProximityPlacementGroupsClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go deleted file mode 100644 index b067fbe22984..000000000000 --- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.json -func ExampleProximityPlacementGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myProximityPlacementGroup", armcompute.ProximityPlacementGroup{ - Location: to.Ptr("westus"), - Properties: &armcompute.ProximityPlacementGroupProperties{ - Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - VMSizes: []*string{ - to.Ptr("Basic_A0"), - to.Ptr("Basic_A2")}, - }, - ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.json -func ExampleProximityPlacementGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "myResourceGroup", "myProximityPlacementGroup", armcompute.ProximityPlacementGroupUpdate{ - Tags: map[string]*string{ - "additionalProp1": to.Ptr("string"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.json -func ExampleProximityPlacementGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "myResourceGroup", "myProximityPlacementGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json -func ExampleProximityPlacementGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myProximityPlacementGroup", &armcompute.ProximityPlacementGroupsClientGetOptions{IncludeColocationStatus: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.json -func ExampleProximityPlacementGroupsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.json -func ExampleProximityPlacementGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go b/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go deleted file mode 100644 index 224d3d1f05fa..000000000000 --- a/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkus.json -func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewResourceSKUsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, - IncludeExtendedLocations: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkusForARegion.json -func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUsForTheSpecifiedRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewResourceSKUsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: to.Ptr("location eq 'westus'"), - IncludeExtendedLocations: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkusWithExtendedLocations.json -func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUsWithExtendedLocationInformation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewResourceSKUsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, - IncludeExtendedLocations: to.Ptr("true"), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go b/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go index d26ba8b6c1e9..ff31b1618b68 100644 --- a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go +++ b/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go @@ -59,7 +59,7 @@ func NewRestorePointCollectionsClient(subscriptionID string, credential azcore.T // CreateOrUpdate - The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints // for more details. When updating a restore point collection, only tags may be modified. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // restorePointCollectionName - The name of the restore point collection. // parameters - Parameters supplied to the Create or Update restore point collection operation. @@ -100,7 +100,7 @@ func (client *RestorePointCollectionsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -118,7 +118,7 @@ func (client *RestorePointCollectionsClient) createOrUpdateHandleResponse(resp * // BeginDelete - The operation to delete the restore point collection. This operation will also delete all the contained restore // points. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // restorePointCollectionName - The name of the Restore Point Collection. // options - RestorePointCollectionsClientBeginDeleteOptions contains the optional parameters for the RestorePointCollectionsClient.BeginDelete @@ -138,7 +138,7 @@ func (client *RestorePointCollectionsClient) BeginDelete(ctx context.Context, re // Delete - The operation to delete the restore point collection. This operation will also delete all the contained restore // points. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *RestorePointCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, options) if err != nil { @@ -174,7 +174,7 @@ func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +182,7 @@ func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Con // Get - The operation to get the restore point collection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // restorePointCollectionName - The name of the restore point collection. // options - RestorePointCollectionsClientGetOptions contains the optional parameters for the RestorePointCollectionsClient.Get @@ -225,7 +225,7 @@ func (client *RestorePointCollectionsClient) getCreateRequest(ctx context.Contex if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -241,7 +241,7 @@ func (client *RestorePointCollectionsClient) getHandleResponse(resp *http.Respon } // NewListPager - Gets the list of restore point collections in a resource group. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - RestorePointCollectionsClientListOptions contains the optional parameters for the RestorePointCollectionsClient.List // method. @@ -289,7 +289,7 @@ func (client *RestorePointCollectionsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,7 +307,7 @@ func (client *RestorePointCollectionsClient) listHandleResponse(resp *http.Respo // NewListAllPager - Gets the list of restore point collections in the subscription. Use nextLink property in the response // to get the next page of restore point collections. Do this till nextLink is not null to fetch all // the restore point collections. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - RestorePointCollectionsClientListAllOptions contains the optional parameters for the RestorePointCollectionsClient.ListAll // method. func (client *RestorePointCollectionsClient) NewListAllPager(options *RestorePointCollectionsClientListAllOptions) *runtime.Pager[RestorePointCollectionsClientListAllResponse] { @@ -350,7 +350,7 @@ func (client *RestorePointCollectionsClient) listAllCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -367,7 +367,7 @@ func (client *RestorePointCollectionsClient) listAllHandleResponse(resp *http.Re // Update - The operation to update the restore point collection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // restorePointCollectionName - The name of the restore point collection. // parameters - Parameters supplied to the Update restore point collection operation. @@ -408,7 +408,7 @@ func (client *RestorePointCollectionsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go b/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go deleted file mode 100644 index 0ccc718774de..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go +++ /dev/null @@ -1,251 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.json -func ExampleRestorePointCollectionsClient_CreateOrUpdate_createOrUpdateARestorePointCollectionForCrossRegionCopy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myRpc", armcompute.RestorePointCollection{ - Location: to.Ptr("norwayeast"), - Tags: map[string]*string{ - "myTag1": to.Ptr("tagValue1"), - }, - Properties: &armcompute.RestorePointCollectionProperties{ - Source: &armcompute.RestorePointCollectionSourceProperties{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate.json -func ExampleRestorePointCollectionsClient_CreateOrUpdate_createOrUpdateARestorePointCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myRpc", armcompute.RestorePointCollection{ - Location: to.Ptr("norwayeast"), - Tags: map[string]*string{ - "myTag1": to.Ptr("tagValue1"), - }, - Properties: &armcompute.RestorePointCollectionProperties{ - Source: &armcompute.RestorePointCollectionSourceProperties{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollections_Update_MaximumSet_Gen.json -func ExampleRestorePointCollectionsClient_Update_restorePointCollectionsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.RestorePointCollectionUpdate{ - Tags: map[string]*string{ - "key8536": to.Ptr("aaaaaaaaaaaaaaaaaaa"), - }, - Properties: &armcompute.RestorePointCollectionProperties{ - Source: &armcompute.RestorePointCollectionSourceProperties{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollections_Update_MinimumSet_Gen.json -func ExampleRestorePointCollectionsClient_Update_restorePointCollectionsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", armcompute.RestorePointCollectionUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollections_Delete_MaximumSet_Gen.json -func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollections_Delete_MinimumSet_Gen.json -func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_Get.json -func ExampleRestorePointCollectionsClient_Get_getARestorePointCollectionButNotTheRestorePointsContainedInTheRestorePointCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myRpc", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json -func ExampleRestorePointCollectionsClient_Get_getARestorePointCollectionIncludingTheRestorePointsContainedInTheRestorePointCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "rpcName", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_ListByResourceGroup.json -func ExampleRestorePointCollectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_ListBySubscription.json -func ExampleRestorePointCollectionsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAllPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/restorepoints_client.go b/sdk/resourcemanager/compute/armcompute/restorepoints_client.go index 31b57ce60a9b..4365cc75ac4e 100644 --- a/sdk/resourcemanager/compute/armcompute/restorepoints_client.go +++ b/sdk/resourcemanager/compute/armcompute/restorepoints_client.go @@ -58,7 +58,7 @@ func NewRestorePointsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreate - The operation to create the restore point. Updating properties of an existing restore point is not allowed // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // restorePointCollectionName - The name of the restore point collection. // restorePointName - The name of the restore point. @@ -79,7 +79,7 @@ func (client *RestorePointsClient) BeginCreate(ctx context.Context, resourceGrou // Create - The operation to create the restore point. Updating properties of an existing restore point is not allowed // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *RestorePointsClient) create(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, parameters, options) if err != nil { @@ -119,7 +119,7 @@ func (client *RestorePointsClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -127,7 +127,7 @@ func (client *RestorePointsClient) createCreateRequest(ctx context.Context, reso // BeginDelete - The operation to delete the restore point. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // restorePointCollectionName - The name of the Restore Point Collection. // restorePointName - The name of the restore point. @@ -147,7 +147,7 @@ func (client *RestorePointsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - The operation to delete the restore point. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *RestorePointsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) if err != nil { @@ -187,7 +187,7 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +195,7 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso // Get - The operation to get the restore point. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // restorePointCollectionName - The name of the restore point collection. // restorePointName - The name of the restore point. @@ -242,7 +242,7 @@ func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourc if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go b/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go deleted file mode 100644 index b6683c10e219..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoint_Copy_BetweenRegions.json -func ExampleRestorePointsClient_BeginCreate_copyARestorePointToADifferentRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "myResourceGroup", "rpcName", "rpName", armcompute.RestorePoint{ - Properties: &armcompute.RestorePointProperties{ - SourceRestorePoint: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName/restorePoints/sourceRpName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoint_Create.json -func ExampleRestorePointsClient_BeginCreate_createARestorePoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "myResourceGroup", "rpcName", "rpName", armcompute.RestorePoint{ - Properties: &armcompute.RestorePointProperties{ - ExcludeDisks: []*armcompute.APIEntityReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoints_Delete_MaximumSet_Gen.json -func ExampleRestorePointsClient_BeginDelete_restorePointsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", "a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoints_Delete_MinimumSet_Gen.json -func ExampleRestorePointsClient_BeginDelete_restorePointsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoint_Get.json -func ExampleRestorePointsClient_Get_getARestorePoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoint_Get_WithInstanceView.json -func ExampleRestorePointsClient_Get_getRestorePointWithInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go deleted file mode 100644 index d4cd3d8029ca..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGallery_List.json -func ExampleSharedGalleriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSharedGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myLocation", &armcompute.SharedGalleriesClientListOptions{SharedTo: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGallery_Get.json -func ExampleSharedGalleriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSharedGalleriesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myLocation", "galleryUniqueName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go deleted file mode 100644 index cda97d337cfb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImages_List.json -func ExampleSharedGalleryImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSharedGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myLocation", "galleryUniqueName", &armcompute.SharedGalleryImagesClientListOptions{SharedTo: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImage_Get.json -func ExampleSharedGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSharedGalleryImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go deleted file mode 100644 index c0fc7442b991..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersions_List.json -func ExampleSharedGalleryImageVersionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSharedGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myLocation", "galleryUniqueName", "myGalleryImageName", &armcompute.SharedGalleryImageVersionsClientListOptions{SharedTo: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersion_Get.json -func ExampleSharedGalleryImageVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSharedGalleryImageVersionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", "myGalleryImageVersionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go b/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go deleted file mode 100644 index 86541b102387..000000000000 --- a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go +++ /dev/null @@ -1,362 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot1", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - StorageAccountID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot1", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart), - SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json -func ExampleSnapshotsClient_BeginUpdate_updateASnapshotWithAcceleratedNetworking() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "mySnapshot", armcompute.SnapshotUpdate{ - Properties: &armcompute.SnapshotUpdateProperties{ - DiskSizeGB: to.Ptr[int32](20), - SupportedCapabilities: &armcompute.SupportedCapabilities{ - AcceleratedNetwork: to.Ptr(false), - }, - }, - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("UpdateSnapshots"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Update.json -func ExampleSnapshotsClient_BeginUpdate_updateASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "mySnapshot", armcompute.SnapshotUpdate{ - Properties: &armcompute.SnapshotUpdateProperties{ - DiskSizeGB: to.Ptr[int32](20), - }, - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("UpdateSnapshots"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Get.json -func ExampleSnapshotsClient_Get_getInformationAboutASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "mySnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_GetIncrementalSnapshot.json -func ExampleSnapshotsClient_Get_getInformationAboutAnIncrementalSnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myIncrementalSnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Delete.json -func ExampleSnapshotsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "mySnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_ListByResourceGroup.json -func ExampleSnapshotsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_ListBySubscription.json -func ExampleSnapshotsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_BeginGetAccess.json -func ExampleSnapshotsClient_BeginGrantAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginGrantAccess(ctx, "myResourceGroup", "mySnapshot", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_EndGetAccess.json -func ExampleSnapshotsClient_BeginRevokeAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRevokeAccess(ctx, "myResourceGroup", "mySnapshot", nil) - 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) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go index ab1e510f1d18..1222d8f98994 100644 --- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go +++ b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go @@ -58,7 +58,7 @@ func NewSSHPublicKeysClient(subscriptionID string, credential azcore.TokenCreden // Create - Creates a new SSH public key resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // sshPublicKeyName - The name of the SSH public key. // parameters - Parameters supplied to create the SSH public key. @@ -98,7 +98,7 @@ func (client *SSHPublicKeysClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -115,7 +115,7 @@ func (client *SSHPublicKeysClient) createHandleResponse(resp *http.Response) (SS // Delete - Delete an SSH public key. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // sshPublicKeyName - The name of the SSH public key. // options - SSHPublicKeysClientDeleteOptions contains the optional parameters for the SSHPublicKeysClient.Delete method. @@ -154,7 +154,7 @@ func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -164,7 +164,7 @@ func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, reso // key. The length of the key will be 3072 bits. This operation can only be performed once per // SSH public key resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // sshPublicKeyName - The name of the SSH public key. // options - SSHPublicKeysClientGenerateKeyPairOptions contains the optional parameters for the SSHPublicKeysClient.GenerateKeyPair @@ -204,7 +204,7 @@ func (client *SSHPublicKeysClient) generateKeyPairCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -221,7 +221,7 @@ func (client *SSHPublicKeysClient) generateKeyPairHandleResponse(resp *http.Resp // Get - Retrieves information about an SSH public key. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // sshPublicKeyName - The name of the SSH public key. // options - SSHPublicKeysClientGetOptions contains the optional parameters for the SSHPublicKeysClient.Get method. @@ -260,7 +260,7 @@ func (client *SSHPublicKeysClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +277,7 @@ func (client *SSHPublicKeysClient) getHandleResponse(resp *http.Response) (SSHPu // NewListByResourceGroupPager - Lists all of the SSH public keys in the specified resource group. Use the nextLink property // in the response to get the next page of SSH public keys. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - SSHPublicKeysClientListByResourceGroupOptions contains the optional parameters for the SSHPublicKeysClient.ListByResourceGroup // method. @@ -325,7 +325,7 @@ func (client *SSHPublicKeysClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,7 +342,7 @@ func (client *SSHPublicKeysClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - Lists all of the SSH public keys in the subscription. Use the nextLink property in the response // to get the next page of SSH public keys. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - SSHPublicKeysClientListBySubscriptionOptions contains the optional parameters for the SSHPublicKeysClient.ListBySubscription // method. func (client *SSHPublicKeysClient) NewListBySubscriptionPager(options *SSHPublicKeysClientListBySubscriptionOptions) *runtime.Pager[SSHPublicKeysClientListBySubscriptionResponse] { @@ -385,7 +385,7 @@ func (client *SSHPublicKeysClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -402,7 +402,7 @@ func (client *SSHPublicKeysClient) listBySubscriptionHandleResponse(resp *http.R // Update - Updates a new SSH public key resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // sshPublicKeyName - The name of the SSH public key. // parameters - Parameters supplied to update the SSH public key. @@ -442,7 +442,7 @@ func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go deleted file mode 100644 index df51c6cb141a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go +++ /dev/null @@ -1,255 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_ListBySubscription_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeysListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_ListBySubscription_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeysListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_ListByResourceGroup_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeysListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_ListByResourceGroup_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeysListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKey_Create.json -func ExampleSSHPublicKeysClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "myResourceGroup", "mySshPublicKeyName", armcompute.SSHPublicKeyResource{ - Location: to.Ptr("westus"), - Properties: &armcompute.SSHPublicKeyResourceProperties{ - PublicKey: to.Ptr("{ssh-rsa public key}"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_Update_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_Update_sshPublicKeysUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{ - Tags: map[string]*string{ - "key2854": to.Ptr("a"), - }, - Properties: &armcompute.SSHPublicKeyResourceProperties{ - PublicKey: to.Ptr("{ssh-rsa public key}"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_Update_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_Update_sshPublicKeysUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_Delete_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_Delete_sshPublicKeysDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_Delete_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_Delete_sshPublicKeysDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKey_Get.json -func ExampleSSHPublicKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "mySshPublicKeyName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_GenerateKeyPair.json -func ExampleSSHPublicKeysClient_GenerateKeyPair() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GenerateKeyPair(ctx, "myResourceGroup", "mySshPublicKeyName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/usage_client.go b/sdk/resourcemanager/compute/armcompute/usage_client.go index eabf3ca506a7..b1a8250b93fa 100644 --- a/sdk/resourcemanager/compute/armcompute/usage_client.go +++ b/sdk/resourcemanager/compute/armcompute/usage_client.go @@ -58,7 +58,7 @@ func NewUsageClient(subscriptionID string, credential azcore.TokenCredential, op // NewListPager - Gets, for the specified location, the current compute resource usage information as well as the limits for // compute resources under the subscription. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The location for which resource usage is queried. // options - UsageClientListOptions contains the optional parameters for the UsageClient.List method. func (client *UsageClient) NewListPager(location string, options *UsageClientListOptions) *runtime.Pager[UsageClientListResponse] { @@ -105,7 +105,7 @@ func (client *UsageClient) listCreateRequest(ctx context.Context, location strin return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go b/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go deleted file mode 100644 index 10d58bdc3bd0..000000000000 --- a/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/Usage_List_MaximumSet_Gen.json -func ExampleUsageClient_NewListPager_usageListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewUsageClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("4_.", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/Usage_List_MinimumSet_Gen.json -func ExampleUsageClient_NewListPager_usageListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewUsageClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("_--", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go index 14094cd76a06..87a39c2ed431 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go @@ -59,7 +59,7 @@ func NewVirtualMachineExtensionImagesClient(subscriptionID string, credential az // Get - Gets a virtual machine extension image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // options - VirtualMachineExtensionImagesClientGetOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.Get // method. @@ -106,7 +106,7 @@ func (client *VirtualMachineExtensionImagesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +123,7 @@ func (client *VirtualMachineExtensionImagesClient) getHandleResponse(resp *http. // ListTypes - Gets a list of virtual machine extension image types. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // options - VirtualMachineExtensionImagesClientListTypesOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListTypes // method. @@ -162,7 +162,7 @@ func (client *VirtualMachineExtensionImagesClient) listTypesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +179,7 @@ func (client *VirtualMachineExtensionImagesClient) listTypesHandleResponse(resp // ListVersions - Gets a list of virtual machine extension image versions. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // options - VirtualMachineExtensionImagesClientListVersionsOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListVersions // method. @@ -231,7 +231,7 @@ func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go deleted file mode 100644 index 418b72b27eeb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_Get_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImagesGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_Get_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImagesGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", "aaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListTypes_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImagesListTypesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListTypes(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListTypes_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImagesListTypesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListTypes(ctx, "aaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListVersions_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImagesListVersionsMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListVersions(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionImagesClientListVersionsOptions{Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - Top: to.Ptr[int32](22), - Orderby: to.Ptr("a"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListVersions_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImagesListVersionsMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListVersions(ctx, "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", &armcompute.VirtualMachineExtensionImagesClientListVersionsOptions{Filter: nil, - Top: nil, - Orderby: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go index 3cc2726fc532..c13471c59490 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go @@ -58,7 +58,7 @@ func NewVirtualMachineExtensionsClient(subscriptionID string, credential azcore. // BeginCreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine where the extension should be created or updated. // vmExtensionName - The name of the virtual machine extension. @@ -79,7 +79,7 @@ func (client *VirtualMachineExtensionsClient) BeginCreateOrUpdate(ctx context.Co // CreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) if err != nil { @@ -119,7 +119,7 @@ func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) @@ -127,7 +127,7 @@ func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx co // BeginDelete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine where the extension should be deleted. // vmExtensionName - The name of the virtual machine extension. @@ -147,7 +147,7 @@ func (client *VirtualMachineExtensionsClient) BeginDelete(ctx context.Context, r // Delete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, options) if err != nil { @@ -187,7 +187,7 @@ func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +195,7 @@ func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Co // Get - The operation to get the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine containing the extension. // vmExtensionName - The name of the virtual machine extension. @@ -243,7 +243,7 @@ func (client *VirtualMachineExtensionsClient) getCreateRequest(ctx context.Conte if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,7 +260,7 @@ func (client *VirtualMachineExtensionsClient) getHandleResponse(resp *http.Respo // List - The operation to get all extensions of a Virtual Machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine containing the extension. // options - VirtualMachineExtensionsClientListOptions contains the optional parameters for the VirtualMachineExtensionsClient.List @@ -303,7 +303,7 @@ func (client *VirtualMachineExtensionsClient) listCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -320,7 +320,7 @@ func (client *VirtualMachineExtensionsClient) listHandleResponse(resp *http.Resp // BeginUpdate - The operation to update the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine where the extension should be updated. // vmExtensionName - The name of the virtual machine extension. @@ -341,7 +341,7 @@ func (client *VirtualMachineExtensionsClient) BeginUpdate(ctx context.Context, r // Update - The operation to update the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineExtensionsClient) update(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) if err != nil { @@ -381,7 +381,7 @@ func (client *VirtualMachineExtensionsClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go deleted file mode 100644 index c7e219420243..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go +++ /dev/null @@ -1,263 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionsCreateOrUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", armcompute.VirtualMachineExtension{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "key9183": to.Ptr("aa"), - }, - Properties: &armcompute.VirtualMachineExtensionProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - EnableAutomaticUpgrade: to.Ptr(true), - ForceUpdateTag: to.Ptr("a"), - InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - Type: to.Ptr("aaaaaaaaa"), - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - Substatuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - }, - ProtectedSettings: map[string]interface{}{}, - Publisher: to.Ptr("extPublisher"), - Settings: map[string]interface{}{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("1.2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionsCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "rgcompute", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineExtension{ - Location: to.Ptr("westus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Update.json -func ExampleVirtualMachineExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myVM", "myVMExtension", armcompute.VirtualMachineExtensionUpdate{ - Properties: &armcompute.VirtualMachineExtensionUpdateProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - }, - }, - Publisher: to.Ptr("extPublisher"), - Settings: map[string]interface{}{ - "UserName": "xyz@microsoft.com", - }, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("1.2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Get_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: to.Ptr("aaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Get_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_List_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "rgcompute", "aaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_List_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go index 8e8eefd5381b..6ceb693c3d98 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go @@ -59,7 +59,7 @@ func NewVirtualMachineImagesClient(subscriptionID string, credential azcore.Toke // Get - Gets a virtual machine image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // publisherName - A valid image publisher. // offer - A valid image publisher offer. @@ -114,7 +114,7 @@ func (client *VirtualMachineImagesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -131,7 +131,7 @@ func (client *VirtualMachineImagesClient) getHandleResponse(resp *http.Response) // List - Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // publisherName - A valid image publisher. // offer - A valid image publisher offer. @@ -190,7 +190,7 @@ func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -207,7 +207,7 @@ func (client *VirtualMachineImagesClient) listHandleResponse(resp *http.Response // ListByEdgeZone - Gets a list of all virtual machine image versions for the specified edge zone // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // edgeZone - The name of the edge zone. // options - VirtualMachineImagesClientListByEdgeZoneOptions contains the optional parameters for the VirtualMachineImagesClient.ListByEdgeZone @@ -247,7 +247,7 @@ func (client *VirtualMachineImagesClient) listByEdgeZoneCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,7 +264,7 @@ func (client *VirtualMachineImagesClient) listByEdgeZoneHandleResponse(resp *htt // ListOffers - Gets a list of virtual machine image offers for the specified location and publisher. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // publisherName - A valid image publisher. // options - VirtualMachineImagesClientListOffersOptions contains the optional parameters for the VirtualMachineImagesClient.ListOffers @@ -304,7 +304,7 @@ func (client *VirtualMachineImagesClient) listOffersCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +321,7 @@ func (client *VirtualMachineImagesClient) listOffersHandleResponse(resp *http.Re // ListPublishers - Gets a list of virtual machine image publishers for the specified Azure location. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // options - VirtualMachineImagesClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesClient.ListPublishers // method. @@ -356,7 +356,7 @@ func (client *VirtualMachineImagesClient) listPublishersCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,7 +373,7 @@ func (client *VirtualMachineImagesClient) listPublishersHandleResponse(resp *htt // ListSKUs - Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // publisherName - A valid image publisher. // offer - A valid image publisher offer. @@ -418,7 +418,7 @@ func (client *VirtualMachineImagesClient) listSKUsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go deleted file mode 100644 index 092cc7f549ab..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go +++ /dev/null @@ -1,252 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_Get_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_Get_virtualMachineImagesGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "aaaaaa", "aaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_Get_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_Get_virtualMachineImagesGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "aaaaaaaaaaaa", "aaaaaaaaaaa", "aa", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_List_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_List_virtualMachineImagesListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "aaaaaaaaaaaaaaa", "aaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - Top: to.Ptr[int32](18), - Orderby: to.Ptr("aa"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_List_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_List_virtualMachineImagesListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "aaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaa", "aaaaaa", &armcompute.VirtualMachineImagesClientListOptions{Expand: nil, - Top: nil, - Orderby: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListOffers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImagesListOffersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListOffers(ctx, "aaaaaaa", "aaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListOffers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImagesListOffersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListOffers(ctx, "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListPublishers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImagesListPublishersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListPublishers(ctx, "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListPublishers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImagesListPublishersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListPublishers(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImagesListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImagesListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaa", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListByEdgeZone_virtualMachineImagesEdgeZoneListByEdgeZoneMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("5ece5940-d962-4dad-a98f-ca9ac0f021a5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListByEdgeZone_virtualMachineImagesEdgeZoneListByEdgeZoneMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesClient("5ece5940-d962-4dad-a98f-ca9ac0f021a5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go index fb020857a215..db9b5a656da9 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go @@ -59,7 +59,7 @@ func NewVirtualMachineImagesEdgeZoneClient(subscriptionID string, credential azc // Get - Gets a virtual machine image in an edge zone. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // edgeZone - The name of the edge zone. // publisherName - A valid image publisher. @@ -119,7 +119,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -136,7 +136,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) getHandleResponse(resp *http.R // List - Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // edgeZone - The name of the edge zone. // publisherName - A valid image publisher. @@ -200,7 +200,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context. if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -217,7 +217,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listHandleResponse(resp *http. // ListOffers - Gets a list of virtual machine image offers for the specified location, edge zone and publisher. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // edgeZone - The name of the edge zone. // publisherName - A valid image publisher. @@ -262,7 +262,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listOffersCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -279,7 +279,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listOffersHandleResponse(resp // ListPublishers - Gets a list of virtual machine image publishers for the specified Azure location and edge zone. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // edgeZone - The name of the edge zone. // options - VirtualMachineImagesEdgeZoneClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.ListPublishers @@ -319,7 +319,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listPublishersCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +336,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listPublishersHandleResponse(r // ListSKUs - Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The name of a supported Azure region. // edgeZone - The name of the edge zone. // publisherName - A valid image publisher. @@ -386,7 +386,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listSKUsCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go deleted file mode 100644 index 63713fa3e100..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go +++ /dev/null @@ -1,214 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_Get_virtualMachineImagesEdgeZoneGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_Get_virtualMachineImagesEdgeZoneGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_List_virtualMachineImagesEdgeZoneListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "aaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesEdgeZoneClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - Top: to.Ptr[int32](12), - Orderby: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_List_virtualMachineImagesEdgeZoneListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesEdgeZoneClientListOptions{Expand: nil, - Top: nil, - Orderby: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListOffers_virtualMachineImagesEdgeZoneListOffersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListOffers(ctx, "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListOffers_virtualMachineImagesEdgeZoneListOffersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListOffers(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListPublishers_virtualMachineImagesEdgeZoneListPublishersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListPublishers(ctx, "aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListPublishers_virtualMachineImagesEdgeZoneListPublishersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListPublishers(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListSKUs_virtualMachineImagesEdgeZoneListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListSKUs(ctx, "aaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListSKUs_virtualMachineImagesEdgeZoneListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListSKUs(ctx, "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go index 2fd8d43e81e9..369411efdd18 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go @@ -58,7 +58,7 @@ func NewVirtualMachineRunCommandsClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - The operation to create or update the run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine where the run command should be created or updated. // runCommandName - The name of the virtual machine run command. @@ -79,7 +79,7 @@ func (client *VirtualMachineRunCommandsClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - The operation to create or update the run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) if err != nil { @@ -119,7 +119,7 @@ func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, runCommand) @@ -127,7 +127,7 @@ func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx c // BeginDelete - The operation to delete the run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine where the run command should be deleted. // runCommandName - The name of the virtual machine run command. @@ -147,7 +147,7 @@ func (client *VirtualMachineRunCommandsClient) BeginDelete(ctx context.Context, // Delete - The operation to delete the run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, runCommandName, options) if err != nil { @@ -187,7 +187,7 @@ func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -195,7 +195,7 @@ func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.C // Get - Gets specific run command for a subscription in a location. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The location upon which run commands is queried. // commandID - The command id. // options - VirtualMachineRunCommandsClientGetOptions contains the optional parameters for the VirtualMachineRunCommandsClient.Get @@ -235,7 +235,7 @@ func (client *VirtualMachineRunCommandsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -252,7 +252,7 @@ func (client *VirtualMachineRunCommandsClient) getHandleResponse(resp *http.Resp // GetByVirtualMachine - The operation to get the run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine containing the run command. // runCommandName - The name of the virtual machine run command. @@ -300,7 +300,7 @@ func (client *VirtualMachineRunCommandsClient) getByVirtualMachineCreateRequest( if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -316,7 +316,7 @@ func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleResponse } // NewListPager - Lists all available run commands for a subscription in a location. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The location upon which run commands is queried. // options - VirtualMachineRunCommandsClientListOptions contains the optional parameters for the VirtualMachineRunCommandsClient.List // method. @@ -364,7 +364,7 @@ func (client *VirtualMachineRunCommandsClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -380,7 +380,7 @@ func (client *VirtualMachineRunCommandsClient) listHandleResponse(resp *http.Res } // NewListByVirtualMachinePager - The operation to get all run commands of a Virtual Machine. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine containing the run command. // options - VirtualMachineRunCommandsClientListByVirtualMachineOptions contains the optional parameters for the VirtualMachineRunCommandsClient.ListByVirtualMachine @@ -436,7 +436,7 @@ func (client *VirtualMachineRunCommandsClient) listByVirtualMachineCreateRequest if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -453,7 +453,7 @@ func (client *VirtualMachineRunCommandsClient) listByVirtualMachineHandleRespons // BeginUpdate - The operation to update the run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine where the run command should be updated. // runCommandName - The name of the virtual machine run command. @@ -474,7 +474,7 @@ func (client *VirtualMachineRunCommandsClient) BeginUpdate(ctx context.Context, // Update - The operation to update the run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) if err != nil { @@ -514,7 +514,7 @@ func (client *VirtualMachineRunCommandsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, runCommand) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go deleted file mode 100644 index 27bf1aad37d5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go +++ /dev/null @@ -1,197 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/RunCommand_List.json -func ExampleVirtualMachineRunCommandsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineRunCommandsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("SoutheastAsia", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/RunCommand_Get.json -func ExampleVirtualMachineRunCommandsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineRunCommandsClient("24fb23e3-6ba3-41f0-9b6e-e41131d5d61e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SoutheastAsia", "RunPowerShellScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.json -func ExampleVirtualMachineRunCommandsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", "myRunCommand", armcompute.VirtualMachineRunCommand{ - Location: to.Ptr("West US"), - Properties: &armcompute.VirtualMachineRunCommandProperties{ - AsyncExecution: to.Ptr(false), - Parameters: []*armcompute.RunCommandInputParameter{ - { - Name: to.Ptr("param1"), - Value: to.Ptr("value1"), - }, - { - Name: to.Ptr("param2"), - Value: to.Ptr("value2"), - }}, - RunAsPassword: to.Ptr(""), - RunAsUser: to.Ptr("user1"), - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Hello World!"), - }, - TimeoutInSeconds: to.Ptr[int32](3600), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_Update.json -func ExampleVirtualMachineRunCommandsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myVM", "myRunCommand", armcompute.VirtualMachineRunCommandUpdate{ - Properties: &armcompute.VirtualMachineRunCommandProperties{ - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Script Source Updated!"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_Delete.json -func ExampleVirtualMachineRunCommandsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myVM", "myRunCommand", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_Get.json -func ExampleVirtualMachineRunCommandsClient_GetByVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByVirtualMachine(ctx, "myResourceGroup", "myVM", "myRunCommand", &armcompute.VirtualMachineRunCommandsClientGetByVirtualMachineOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_List.json -func ExampleVirtualMachineRunCommandsClient_NewListByVirtualMachinePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByVirtualMachinePager("myResourceGroup", "myVM", &armcompute.VirtualMachineRunCommandsClientListByVirtualMachineOptions{Expand: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go index 1b297b7eab58..42a746d9fdcf 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go @@ -59,7 +59,7 @@ func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCred // BeginAssessPatches - Assess patches on the VM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginAssessPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginAssessPatches @@ -80,7 +80,7 @@ func (client *VirtualMachinesClient) BeginAssessPatches(ctx context.Context, res // AssessPatches - Assess patches on the VM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*http.Response, error) { req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -116,7 +116,7 @@ func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -125,7 +125,7 @@ func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Cont // BeginCapture - Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create // similar VMs. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // parameters - Parameters supplied to the Capture Virtual Machine operation. @@ -148,7 +148,7 @@ func (client *VirtualMachinesClient) BeginCapture(ctx context.Context, resourceG // Capture - Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar // VMs. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) capture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesClientBeginCaptureOptions) (*http.Response, error) { req, err := client.captureCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { @@ -184,7 +184,7 @@ func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -193,7 +193,7 @@ func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, r // BeginConvertToManagedDisks - Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated // before invoking this operation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginConvertToManagedDisksOptions contains the optional parameters for the VirtualMachinesClient.BeginConvertToManagedDisks @@ -213,7 +213,7 @@ func (client *VirtualMachinesClient) BeginConvertToManagedDisks(ctx context.Cont // ConvertToManagedDisks - Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated // before invoking this operation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) convertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginConvertToManagedDisksOptions) (*http.Response, error) { req, err := client.convertToManagedDisksCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -249,7 +249,7 @@ func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,7 +258,7 @@ func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx cont // BeginCreateOrUpdate - The operation to create or update a virtual machine. Please note some properties can be set only // during virtual machine creation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // parameters - Parameters supplied to the Create Virtual Machine operation. @@ -279,7 +279,7 @@ func (client *VirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - The operation to create or update a virtual machine. Please note some properties can be set only during // virtual machine creation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { @@ -315,7 +315,7 @@ func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -324,7 +324,7 @@ func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Con // BeginDeallocate - Shuts down the virtual machine and releases the compute resources. You are not billed for the compute // resources that this virtual machine uses. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginDeallocateOptions contains the optional parameters for the VirtualMachinesClient.BeginDeallocate @@ -344,7 +344,7 @@ func (client *VirtualMachinesClient) BeginDeallocate(ctx context.Context, resour // Deallocate - Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources // that this virtual machine uses. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) deallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -383,7 +383,7 @@ func (client *VirtualMachinesClient) deallocateCreateRequest(ctx context.Context if options != nil && options.Hibernate != nil { reqQP.Set("hibernate", strconv.FormatBool(*options.Hibernate)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -391,7 +391,7 @@ func (client *VirtualMachinesClient) deallocateCreateRequest(ctx context.Context // BeginDelete - The operation to delete a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete @@ -410,7 +410,7 @@ func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGr // Delete - The operation to delete a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -449,7 +449,7 @@ func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, re if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -461,7 +461,7 @@ func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, re // please refer to How to create an image of a virtual machine or VHD // [https://docs.microsoft.com/azure/virtual-machines/linux/capture-image]. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientGeneralizeOptions contains the optional parameters for the VirtualMachinesClient.Generalize @@ -501,7 +501,7 @@ func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -509,7 +509,7 @@ func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context // Get - Retrieves information about the model view or the instance view of a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. @@ -551,7 +551,7 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -568,7 +568,7 @@ func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (Vir // BeginInstallPatches - Installs patches on the VM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // installPatchesInput - Input for InstallPatches as directly received by the API @@ -590,7 +590,7 @@ func (client *VirtualMachinesClient) BeginInstallPatches(ctx context.Context, re // InstallPatches - Installs patches on the VM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*http.Response, error) { req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, vmName, installPatchesInput, options) if err != nil { @@ -626,7 +626,7 @@ func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, installPatchesInput) @@ -634,7 +634,7 @@ func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Con // InstanceView - Retrieves information about the run-time state of a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientInstanceViewOptions contains the optional parameters for the VirtualMachinesClient.InstanceView @@ -674,7 +674,7 @@ func (client *VirtualMachinesClient) instanceViewCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -691,7 +691,7 @@ func (client *VirtualMachinesClient) instanceViewHandleResponse(resp *http.Respo // NewListPager - Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response // to get the next page of virtual machines. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.List method. func (client *VirtualMachinesClient) NewListPager(resourceGroupName string, options *VirtualMachinesClientListOptions) *runtime.Pager[VirtualMachinesClientListResponse] { @@ -741,7 +741,7 @@ func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, reso if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -758,7 +758,7 @@ func (client *VirtualMachinesClient) listHandleResponse(resp *http.Response) (Vi // NewListAllPager - Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response // to get the next page of virtual machines. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.ListAll method. func (client *VirtualMachinesClient) NewListAllPager(options *VirtualMachinesClientListAllOptions) *runtime.Pager[VirtualMachinesClientListAllResponse] { return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListAllResponse]{ @@ -800,7 +800,7 @@ func (client *VirtualMachinesClient) listAllCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.StatusOnly != nil { reqQP.Set("statusOnly", *options.StatusOnly) } @@ -822,7 +822,7 @@ func (client *VirtualMachinesClient) listAllHandleResponse(resp *http.Response) } // NewListAvailableSizesPager - Lists all available virtual machine sizes to which the specified virtual machine can be resized. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientListAvailableSizesOptions contains the optional parameters for the VirtualMachinesClient.ListAvailableSizes @@ -869,7 +869,7 @@ func (client *VirtualMachinesClient) listAvailableSizesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -885,7 +885,7 @@ func (client *VirtualMachinesClient) listAvailableSizesHandleResponse(resp *http } // NewListByLocationPager - Gets all the virtual machines under the specified subscription for the specified location. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The location for which virtual machines under the subscription are queried. // options - VirtualMachinesClientListByLocationOptions contains the optional parameters for the VirtualMachinesClient.ListByLocation // method. @@ -933,7 +933,7 @@ func (client *VirtualMachinesClient) listByLocationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -950,7 +950,7 @@ func (client *VirtualMachinesClient) listByLocationHandleResponse(resp *http.Res // BeginPerformMaintenance - The operation to perform maintenance on a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachinesClient.BeginPerformMaintenance @@ -969,7 +969,7 @@ func (client *VirtualMachinesClient) BeginPerformMaintenance(ctx context.Context // PerformMaintenance - The operation to perform maintenance on a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) performMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1005,7 +1005,7 @@ func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1014,7 +1014,7 @@ func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context // BeginPowerOff - The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same // provisioned resources. You are still charged for this virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginPowerOffOptions contains the optional parameters for the VirtualMachinesClient.BeginPowerOff @@ -1034,7 +1034,7 @@ func (client *VirtualMachinesClient) BeginPowerOff(ctx context.Context, resource // PowerOff - The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned // resources. You are still charged for this virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) powerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1073,7 +1073,7 @@ func (client *VirtualMachinesClient) powerOffCreateRequest(ctx context.Context, if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1081,7 +1081,7 @@ func (client *VirtualMachinesClient) powerOffCreateRequest(ctx context.Context, // BeginReapply - The operation to reapply a virtual machine's state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginReapplyOptions contains the optional parameters for the VirtualMachinesClient.BeginReapply @@ -1100,7 +1100,7 @@ func (client *VirtualMachinesClient) BeginReapply(ctx context.Context, resourceG // Reapply - The operation to reapply a virtual machine's state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) reapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReapplyOptions) (*http.Response, error) { req, err := client.reapplyCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1136,7 +1136,7 @@ func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1144,7 +1144,7 @@ func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, r // BeginRedeploy - Shuts down the virtual machine, moves it to a new node, and powers it back on. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginRedeployOptions contains the optional parameters for the VirtualMachinesClient.BeginRedeploy @@ -1163,7 +1163,7 @@ func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resource // Redeploy - Shuts down the virtual machine, moves it to a new node, and powers it back on. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1199,7 +1199,7 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1207,7 +1207,7 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, // BeginReimage - Reimages the virtual machine which has an ephemeral OS disk back to its initial state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginReimageOptions contains the optional parameters for the VirtualMachinesClient.BeginReimage @@ -1226,7 +1226,7 @@ func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceG // Reimage - Reimages the virtual machine which has an ephemeral OS disk back to its initial state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1262,7 +1262,7 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -1273,7 +1273,7 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r // BeginRestart - The operation to restart a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginRestartOptions contains the optional parameters for the VirtualMachinesClient.BeginRestart @@ -1292,7 +1292,7 @@ func (client *VirtualMachinesClient) BeginRestart(ctx context.Context, resourceG // Restart - The operation to restart a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) restart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1328,7 +1328,7 @@ func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1336,7 +1336,7 @@ func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, r // RetrieveBootDiagnosticsData - The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientRetrieveBootDiagnosticsDataOptions contains the optional parameters for the VirtualMachinesClient.RetrieveBootDiagnosticsData @@ -1379,7 +1379,7 @@ func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataCreateRequest(ct if options != nil && options.SasURIExpirationTimeInMinutes != nil { reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1396,7 +1396,7 @@ func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataHandleResponse(r // BeginRunCommand - Run command on the VM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // parameters - Parameters supplied to the Run command operation. @@ -1418,7 +1418,7 @@ func (client *VirtualMachinesClient) BeginRunCommand(ctx context.Context, resour // RunCommand - Run command on the VM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) runCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesClientBeginRunCommandOptions) (*http.Response, error) { req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { @@ -1454,7 +1454,7 @@ func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -1462,7 +1462,7 @@ func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context // SimulateEviction - The operation to simulate the eviction of spot virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientSimulateEvictionOptions contains the optional parameters for the VirtualMachinesClient.SimulateEviction @@ -1502,7 +1502,7 @@ func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1510,7 +1510,7 @@ func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.C // BeginStart - The operation to start a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // options - VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart @@ -1529,7 +1529,7 @@ func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGro // Start - The operation to start a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1565,7 +1565,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1573,7 +1573,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res // BeginUpdate - The operation to update a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmName - The name of the virtual machine. // parameters - Parameters supplied to the Update Virtual Machine operation. @@ -1593,7 +1593,7 @@ func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGr // Update - The operation to update a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachinesClient) update(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { @@ -1629,7 +1629,7 @@ func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go deleted file mode 100644 index 5fd00ec91245..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go +++ /dev/null @@ -1,3857 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ListBySubscription_ByLocation.json -func ExampleVirtualMachinesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLocationPager("eastus", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Capture_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginCapture_virtualMachinesCaptureMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCapture(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineCaptureParameters{ - DestinationContainerName: to.Ptr("aaaaaaa"), - OverwriteVhds: to.Ptr(true), - VhdPrefix: to.Ptr("aaaaaaaaa"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Capture_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginCapture_virtualMachinesCaptureMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCapture(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VirtualMachineCaptureParameters{ - DestinationContainerName: to.Ptr("aaaaaaa"), - OverwriteVhds: to.Ptr(true), - VhdPrefix: to.Ptr("aaaaaaaaa"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingAssessmentModeOfImageDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("UbuntuServer"), - Publisher: to.Ptr("Canonical"), - SKU: to.Ptr("16.04-LTS"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndAutomaticByPlatformSettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform), - AutomaticByPlatformSettings: &armcompute.LinuxVMGuestPatchAutomaticByPlatformSettings{ - RebootSetting: to.Ptr(armcompute.LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), - }, - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("UbuntuServer"), - Publisher: to.Ptr("Canonical"), - SKU: to.Ptr("16.04-LTS"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingPatchModeOfImageDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - PatchSettings: &armcompute.LinuxPatchSettings{ - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("UbuntuServer"), - Publisher: to.Ptr("Canonical"), - SKU: to.Ptr("16.04-LTS"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform), - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("UbuntuServer"), - Publisher: to.Ptr("Canonical"), - SKU: to.Ptr("16.04-LTS"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromACommunityGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - CommunityGalleryImageID: to.Ptr("/CommunityGalleries/galleryPublicName/Images/communityGalleryImageName/Versions/communityGalleryImageVersionName"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromASharedGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - SharedGalleryImageID: to.Ptr("/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithDiskControllerType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD4V3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe), - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("U29tZSBDdXN0b20gRGF0YQ=="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithHibernationEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{ - Location: to.Ptr("eastus2euap"), - Properties: &armcompute.VirtualMachineProperties{ - AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - HibernationEnabled: to.Ptr(true), - }, - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("{vm-name}"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2019-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("vmOSdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithUefiSettingsOfSecureBootAndVTpm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windowsserver-gen2preview-preview"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows10-tvm"), - Version: to.Ptr("18363.592.2001092016"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUserData.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithUserData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("{vm-name}"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("vmOSdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_CreateWithVMSizeProperties.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithVmSizeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD4V3), - VMSizeProperties: &armcompute.VMSizeProperties{ - VCPUsAvailable: to.Ptr[int32](1), - VCPUsPerCore: to.Ptr[int32](1), - }, - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("U29tZSBDdXN0b20gRGF0YQ=="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithNetworkInterfaceConfiguration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - { - Name: to.Ptr("{nic-config-name}"), - Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - { - Name: to.Ptr("{ip-config-name}"), - Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - Primary: to.Ptr(true), - PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - Name: to.Ptr("{publicIP-config-name}"), - Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDetach), - PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodStatic), - }, - SKU: &armcompute.PublicIPAddressSKU{ - Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - Tier: to.Ptr(armcompute.PublicIPAddressSKUTierGlobal), - }, - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSecurityTypeConfidentialVmWithCustomerManagedKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2as_v5")), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("2019-datacenter-cvm"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows-cvm"), - Version: to.Ptr("17763.2183.2109130127"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - SecurityProfile: &armcompute.VMDiskSecurityProfile{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesDiskWithVMGuestState), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSecurityTypeConfidentialVmWithPlatformManagedKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2as_v5")), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("2019-datacenter-cvm"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows-cvm"), - Version: to.Ptr("17763.2183.2109130127"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - SecurityProfile: &armcompute.VMDiskSecurityProfile{ - SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesDiskWithVMGuestState), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingAssessmentModeOfImageDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByOs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByOS), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndAutomaticByPlatformSettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{ - RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), - }, - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndEnableHotpatchingSetToTrue() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - EnableHotpatching: to.Ptr(true), - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfManual() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createACustomImageVmFromAnUnmanagedGeneralizedOsImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd"), - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAPlatformImageVmWithUnmanagedOsAndDataDisks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd"), - }, - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd"), - }, - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromACustomImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromAGeneralizedSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromASpecializedSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMacine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - PlatformFaultDomain: to.Ptr[int32](1), - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - VirtualMachineScaleSet: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{existing-flex-vmss-name-with-platformFaultDomainCount-greater-than-1}"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmInAnAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - AvailabilitySet: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}"), - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithApplicationProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - ApplicationProfile: &armcompute.ApplicationProfile{ - GalleryApplications: []*armcompute.VMGalleryApplication{ - { - ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - EnableAutomaticUpgrade: to.Ptr(false), - Order: to.Ptr[int32](1), - PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - Tags: to.Ptr("myTag1"), - TreatFailureAsDeploymentFailure: to.Ptr(false), - }, - { - PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - }}, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("{image_offer}"), - Publisher: to.Ptr("{image_publisher}"), - SKU: to.Ptr("{image_sku}"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithDiskEncryptionSetResourceIdInTheOsDiskAndDataDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - ManagedDisk: &armcompute.ManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - { - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - ManagedDisk: &armcompute.ManagedDiskParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}"), - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }}, - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithHostEncryptionUsingEncryptionAtHostProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - EncryptionAtHost: to.Ptr(true), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithScheduledEventsProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT10M"), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithAMarketplaceImagePlan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithAnExtensionsTimeBudget() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionsTimeBudget: to.Ptr("PT30M"), - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMacine_Create_WithBootDiagnostics.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithBootDiagnostics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEmptyDataDisks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDiskProvisioningInCacheDiskUsingPlacementProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - }, - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDiskProvisioningInResourceDiskUsingPlacementProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - Placement: to.Ptr(armcompute.DiffDiskPlacementResourceDisk), - }, - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - }, - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithManagedBootDiagnostics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithPasswordAuthentication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithPremiumStorage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSshAuthentication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armcompute.SSHConfiguration{ - PublicKeys: []*armcompute.SSHPublicKey{ - { - Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - }}, - }, - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("{image_offer}"), - Publisher: to.Ptr("{image_publisher}"), - SKU: to.Ptr("{image_sku}"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createOrUpdateAVmWithCapacityReservation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - CapacityReservation: &armcompute.CapacityReservationProfile{ - CapacityReservationGroup: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.json -func ExampleVirtualMachinesClient_BeginUpdate_updateAVmByDetachingDataDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachineUpdate{ - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - ToBeDetached: to.Ptr(true), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - ToBeDetached: to.Ptr(false), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.json -func ExampleVirtualMachinesClient_BeginUpdate_updateAVmByForceDetachingDataDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachineUpdate{ - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - ToBeDetached: to.Ptr(true), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - ToBeDetached: to.Ptr(false), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Delete_Force.json -func ExampleVirtualMachinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get.json -func ExampleVirtualMachinesClient_Get_getAVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json -func ExampleVirtualMachinesClient_Get_getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json -func ExampleVirtualMachinesClient_Get_getAVirtualMachineWithDiskControllerTypeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json -func ExampleVirtualMachinesClient_Get_getAVirtualMachineWithVmSizeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceView.json -func ExampleVirtualMachinesClient_InstanceView_getVirtualMachineInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.InstanceView(ctx, "myResourceGroup", "myVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json -func ExampleVirtualMachinesClient_InstanceView_getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.InstanceView(ctx, "myResourceGroup", "myVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ConvertToManagedDisks_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachinesConvertToManagedDisksMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginConvertToManagedDisks(ctx, "rgcompute", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ConvertToManagedDisks_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachinesConvertToManagedDisksMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginConvertToManagedDisks(ctx, "rgcompute", "aaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachinesDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaa", &armcompute.VirtualMachinesClientBeginDeallocateOptions{Hibernate: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachinesDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginDeallocateOptions{Hibernate: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Generalize.json -func ExampleVirtualMachinesClient_Generalize() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Generalize(ctx, "myResourceGroup", "myVMName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_List_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_NewListPager_virtualMachinesListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_List_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_NewListPager_virtualMachinesListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ListAll_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_NewListAllPager_virtualMachinesListAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: to.Ptr("aaaaaa"), - Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ListAll_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_NewListAllPager_virtualMachinesListAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: nil, - Filter: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ListAvailableVmSizes.json -func ExampleVirtualMachinesClient_NewListAvailableSizesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAvailableSizesPager("myResourceGroup", "myVmName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinesPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinesPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginPowerOffOptions{SkipShutdown: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Reapply.json -func ExampleVirtualMachinesClient_BeginReapply() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReapply(ctx, "ResourceGroup", "VMName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Restart_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRestart_virtualMachinesRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Restart_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRestart_virtualMachinesRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "rgcompute", "aaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Start_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginStart_virtualMachinesStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Start_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginStart_virtualMachinesStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, "rgcompute", "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachinesRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, "rgcompute", "a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachinesRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Reimage.json -func ExampleVirtualMachinesClient_BeginReimage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimage(ctx, "myResourceGroup", "myVMName", &armcompute.VirtualMachinesClientBeginReimageOptions{Parameters: &armcompute.VirtualMachineReimageParameters{ - TempDisk: to.Ptr(true), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.json -func ExampleVirtualMachinesClient_RetrieveBootDiagnosticsData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "VMName", &armcompute.VirtualMachinesClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinesPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinesPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_SimulateEviction.json -func ExampleVirtualMachinesClient_SimulateEviction() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.SimulateEviction(ctx, "ResourceGroup", "VMName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_AssessPatches.json -func ExampleVirtualMachinesClient_BeginAssessPatches() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginAssessPatches(ctx, "myResourceGroupName", "myVMName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_InstallPatches.json -func ExampleVirtualMachinesClient_BeginInstallPatches() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginInstallPatches(ctx, "myResourceGroupName", "myVMName", armcompute.VirtualMachineInstallPatchesParameters{ - MaximumDuration: to.Ptr("PT4H"), - RebootSetting: to.Ptr(armcompute.VMGuestPatchRebootSettingIfRequired), - WindowsParameters: &armcompute.WindowsParameters{ - ClassificationsToInclude: []*armcompute.VMGuestPatchClassificationWindows{ - to.Ptr(armcompute.VMGuestPatchClassificationWindowsCritical), - to.Ptr(armcompute.VMGuestPatchClassificationWindowsSecurity)}, - MaxPatchPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-19T02:36:43.0539904+00:00"); return t }()), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand.json -func ExampleVirtualMachinesClient_BeginRunCommand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachinesClient("24fb23e3-6ba3-41f0-9b6e-e41131d5d61e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRunCommand(ctx, "crptestar98131", "vm3036", armcompute.RunCommandInput{ - CommandID: to.Ptr("RunPowerShellScript"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go index 407faf4891fb..2b679d5ae353 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go @@ -58,7 +58,7 @@ func NewVirtualMachineScaleSetExtensionsClient(subscriptionID string, credential // BeginCreateOrUpdate - The operation to create or update an extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set where the extension should be create or updated. // vmssExtensionName - The name of the VM scale set extension. @@ -79,7 +79,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) BeginCreateOrUpdate(ctx co // CreateOrUpdate - The operation to create or update an extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) if err != nil { @@ -119,7 +119,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) @@ -127,7 +127,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateReques // BeginDelete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set where the extension should be deleted. // vmssExtensionName - The name of the VM scale set extension. @@ -147,7 +147,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) BeginDelete(ctx context.Co // Delete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) if err != nil { @@ -187,7 +187,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +195,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx co // Get - The operation to get the extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set containing the extension. // vmssExtensionName - The name of the VM scale set extension. @@ -243,7 +243,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) getCreateRequest(ctx conte if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +259,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) getHandleResponse(resp *ht } // NewListPager - Gets a list of all extensions in a VM scale set. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set containing the extension. // options - VirtualMachineScaleSetExtensionsClientListOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.List @@ -312,7 +312,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) listCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +329,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) listHandleResponse(resp *h // BeginUpdate - The operation to update an extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set where the extension should be updated. // vmssExtensionName - The name of the VM scale set extension. @@ -350,7 +350,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) BeginUpdate(ctx context.Co // Update - The operation to update an extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) if err != nil { @@ -390,7 +390,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) updateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go deleted file mode 100644 index a00e0cf6eef1..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go +++ /dev/null @@ -1,267 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionsCreateOrUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetExtension{ - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(true), - EnableAutomaticUpgrade: to.Ptr(true), - ForceUpdateTag: to.Ptr("aaaaaaaaa"), - ProtectedSettings: map[string]interface{}{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]interface{}{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionsCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaa", armcompute.VirtualMachineScaleSetExtension{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", armcompute.VirtualMachineScaleSetExtensionUpdate{ - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(true), - EnableAutomaticUpgrade: to.Ptr(true), - ForceUpdateTag: to.Ptr("aaaaaaaaa"), - ProtectedSettings: map[string]interface{}{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]interface{}{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", armcompute.VirtualMachineScaleSetExtensionUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "rgcompute", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Get_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: to.Ptr("aaaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Get_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go index b8a62aae2e33..f09866e1bd78 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go @@ -58,7 +58,7 @@ func NewVirtualMachineScaleSetRollingUpgradesClient(subscriptionID string, crede // BeginCancel - Cancels the current virtual machine scale set rolling upgrade. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.BeginCancel @@ -77,7 +77,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginCancel(ctx conte // Cancel - Cancels the current virtual machine scale set rolling upgrade. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) cancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions) (*http.Response, error) { req, err := client.cancelCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -113,7 +113,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,7 +121,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(c // GetLatest - Gets the status of the latest virtual machine scale set rolling upgrade. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetRollingUpgradesClientGetLatestOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.GetLatest @@ -161,7 +161,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleRespon // to the latest available extension version. Instances which are already running the latest extension versions // are not affected. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions contains the optional parameters @@ -201,7 +201,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartExtensionUp // the latest available extension version. Instances which are already running the latest extension versions // are not affected. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions) (*http.Response, error) { req, err := client.startExtensionUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -237,7 +237,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,7 +247,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade // Platform Image OS version. Instances which are already running the latest available OS version are not // affected. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions contains the optional parameters for the @@ -268,7 +268,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartOSUpgrade(c // Image OS version. Instances which are already running the latest available OS version are not // affected. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions) (*http.Response, error) { req, err := client.startOSUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -304,7 +304,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go deleted file mode 100644 index 95c2e88ff9a9..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go +++ /dev/null @@ -1,160 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_Cancel_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradesCancelMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCancel(ctx, "rgcompute", "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_Cancel_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradesCancelMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCancel(ctx, "rgcompute", "aaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradesStartOsUpgradeMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStartOSUpgrade(ctx, "rgcompute", "aaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradesStartOsUpgradeMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStartOSUpgrade(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartExtensionUpgrade() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStartExtensionUpgrade(ctx, "myResourceGroup", "{vmss-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_GetLatest_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradesGetLatestMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_GetLatest_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradesGetLatestMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go index 253594e02783..bfc8a705f1b0 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go @@ -59,7 +59,7 @@ func NewVirtualMachineScaleSetsClient(subscriptionID string, credential azcore.T // ConvertToSinglePlacementGroup - Converts SinglePlacementGroup property to false for a existing virtual machine scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the virtual machine scale set to create or update. // parameters - The input object for ConvertToSinglePlacementGroup API. @@ -100,7 +100,7 @@ func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -108,7 +108,7 @@ func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreate // BeginCreateOrUpdate - Create or update a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set to create or update. // parameters - The scale set object. @@ -128,7 +128,7 @@ func (client *VirtualMachineScaleSetsClient) BeginCreateOrUpdate(ctx context.Con // CreateOrUpdate - Create or update a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { @@ -164,7 +164,7 @@ func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -174,7 +174,7 @@ func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx con // the compute resources. You are not billed for the compute resources that this virtual machine // scale set deallocates. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginDeallocateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDeallocate @@ -195,7 +195,7 @@ func (client *VirtualMachineScaleSetsClient) BeginDeallocate(ctx context.Context // compute resources. You are not billed for the compute resources that this virtual machine // scale set deallocates. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -231,7 +231,7 @@ func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -242,7 +242,7 @@ func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context // BeginDelete - Deletes a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDelete @@ -261,7 +261,7 @@ func (client *VirtualMachineScaleSetsClient) BeginDelete(ctx context.Context, re // Delete - Deletes a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -300,7 +300,7 @@ func (client *VirtualMachineScaleSetsClient) deleteCreateRequest(ctx context.Con if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -308,7 +308,7 @@ func (client *VirtualMachineScaleSetsClient) deleteCreateRequest(ctx context.Con // BeginDeleteInstances - Deletes virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // vmInstanceIDs - A list of virtual machine instance IDs from the VM scale set. @@ -328,7 +328,7 @@ func (client *VirtualMachineScaleSetsClient) BeginDeleteInstances(ctx context.Co // DeleteInstances - Deletes virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) deleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginDeleteInstancesOptions) (*http.Response, error) { req, err := client.deleteInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) if err != nil { @@ -367,7 +367,7 @@ func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx co if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, vmInstanceIDs) @@ -376,7 +376,7 @@ func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx co // ForceRecoveryServiceFabricPlatformUpdateDomainWalk - Manual platform update domain walk to update virtual machines in a // service fabric virtual machine scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // platformUpdateDomain - The platform update domain for which a manual recovery walk is requested @@ -417,7 +417,7 @@ func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformU return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") reqQP.Set("platformUpdateDomain", strconv.FormatInt(int64(platformUpdateDomain), 10)) if options != nil && options.Zone != nil { reqQP.Set("zone", *options.Zone) @@ -441,7 +441,7 @@ func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformU // Get - Display information about a virtual machine scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetsClient.Get @@ -481,7 +481,7 @@ func (client *VirtualMachineScaleSetsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -501,7 +501,7 @@ func (client *VirtualMachineScaleSetsClient) getHandleResponse(resp *http.Respon // GetInstanceView - Gets the status of a VM scale set instance. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientGetInstanceViewOptions contains the optional parameters for the VirtualMachineScaleSetsClient.GetInstanceView @@ -541,7 +541,7 @@ func (client *VirtualMachineScaleSetsClient) getInstanceViewCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -557,7 +557,7 @@ func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleResponse(resp } // NewGetOSUpgradeHistoryPager - Gets list of OS upgrades on a VM scale set instance. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientGetOSUpgradeHistoryOptions contains the optional parameters for the VirtualMachineScaleSetsClient.GetOSUpgradeHistory @@ -610,7 +610,7 @@ func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -626,7 +626,7 @@ func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleResponse(r } // NewListPager - Gets a list of all VM scale sets under a resource group. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // options - VirtualMachineScaleSetsClientListOptions contains the optional parameters for the VirtualMachineScaleSetsClient.List // method. @@ -674,7 +674,7 @@ func (client *VirtualMachineScaleSetsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -692,7 +692,7 @@ func (client *VirtualMachineScaleSetsClient) listHandleResponse(resp *http.Respo // NewListAllPager - Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use // nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is // null to fetch all the VM Scale Sets. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // options - VirtualMachineScaleSetsClientListAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListAll // method. func (client *VirtualMachineScaleSetsClient) NewListAllPager(options *VirtualMachineScaleSetsClientListAllOptions) *runtime.Pager[VirtualMachineScaleSetsClientListAllResponse] { @@ -735,7 +735,7 @@ func (client *VirtualMachineScaleSetsClient) listAllCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -751,7 +751,7 @@ func (client *VirtualMachineScaleSetsClient) listAllHandleResponse(resp *http.Re } // NewListByLocationPager - Gets all the VM scale sets under the specified subscription for the specified location. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The location for which VM scale sets under the subscription are queried. // options - VirtualMachineScaleSetsClientListByLocationOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListByLocation // method. @@ -799,7 +799,7 @@ func (client *VirtualMachineScaleSetsClient) listByLocationCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -816,7 +816,7 @@ func (client *VirtualMachineScaleSetsClient) listByLocationHandleResponse(resp * // NewListSKUsPager - Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances // allowed for each SKU. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientListSKUsOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListSKUs @@ -869,7 +869,7 @@ func (client *VirtualMachineScaleSetsClient) listSKUsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -888,7 +888,7 @@ func (client *VirtualMachineScaleSetsClient) listSKUsHandleResponse(resp *http.R // which are not eligible for perform maintenance will be failed. Please refer to best practices for more // details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginPerformMaintenance @@ -909,7 +909,7 @@ func (client *VirtualMachineScaleSetsClient) BeginPerformMaintenance(ctx context // are not eligible for perform maintenance will be failed. Please refer to best practices for more // details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -945,7 +945,7 @@ func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -958,7 +958,7 @@ func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx // and you are getting charged for the resources. Instead, use deallocate to release resources and // avoid charges. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginPowerOffOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginPowerOff @@ -979,7 +979,7 @@ func (client *VirtualMachineScaleSetsClient) BeginPowerOff(ctx context.Context, // you are getting charged for the resources. Instead, use deallocate to release resources and // avoid charges. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1018,7 +1018,7 @@ func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.C if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1030,7 +1030,7 @@ func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.C // BeginRedeploy - Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers // them back on. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginRedeployOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRedeploy @@ -1050,7 +1050,7 @@ func (client *VirtualMachineScaleSetsClient) BeginRedeploy(ctx context.Context, // Redeploy - Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them // back on. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1086,7 +1086,7 @@ func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1099,7 +1099,7 @@ func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.C // a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is // reset to initial state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginReimageOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReimage @@ -1120,7 +1120,7 @@ func (client *VirtualMachineScaleSetsClient) BeginReimage(ctx context.Context, r // OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is // reset to initial state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1156,7 +1156,7 @@ func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMScaleSetReimageInput != nil { @@ -1168,7 +1168,7 @@ func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Co // BeginReimageAll - Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation // is only supported for managed disks. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginReimageAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReimageAll @@ -1188,7 +1188,7 @@ func (client *VirtualMachineScaleSetsClient) BeginReimageAll(ctx context.Context // ReimageAll - Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation // is only supported for managed disks. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageAllOptions) (*http.Response, error) { req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1224,7 +1224,7 @@ func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1235,7 +1235,7 @@ func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context // BeginRestart - Restarts one or more virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginRestartOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRestart @@ -1254,7 +1254,7 @@ func (client *VirtualMachineScaleSetsClient) BeginRestart(ctx context.Context, r // Restart - Restarts one or more virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1290,7 +1290,7 @@ func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1301,7 +1301,7 @@ func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Co // BeginSetOrchestrationServiceState - Changes ServiceState property for a given service // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the virtual machine scale set to create or update. // parameters - The input object for SetOrchestrationServiceState API. @@ -1321,7 +1321,7 @@ func (client *VirtualMachineScaleSetsClient) BeginSetOrchestrationServiceState(c // SetOrchestrationServiceState - Changes ServiceState property for a given service // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions) (*http.Response, error) { req, err := client.setOrchestrationServiceStateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { @@ -1357,7 +1357,7 @@ func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -1365,7 +1365,7 @@ func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateR // BeginStart - Starts one or more virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetsClientBeginStartOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginStart @@ -1384,7 +1384,7 @@ func (client *VirtualMachineScaleSetsClient) BeginStart(ctx context.Context, res // Start - Starts one or more virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1420,7 +1420,7 @@ func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1431,7 +1431,7 @@ func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Cont // BeginUpdate - Update a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set to create or update. // parameters - The scale set object. @@ -1451,7 +1451,7 @@ func (client *VirtualMachineScaleSetsClient) BeginUpdate(ctx context.Context, re // Update - Update a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { @@ -1487,7 +1487,7 @@ func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -1495,7 +1495,7 @@ func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Con // BeginUpdateInstances - Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // vmInstanceIDs - A list of virtual machine instance IDs from the VM scale set. @@ -1515,7 +1515,7 @@ func (client *VirtualMachineScaleSetsClient) BeginUpdateInstances(ctx context.Co // UpdateInstances - Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetsClient) updateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginUpdateInstancesOptions) (*http.Response, error) { req, err := client.updateInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) if err != nil { @@ -1551,7 +1551,7 @@ func (client *VirtualMachineScaleSetsClient) updateInstancesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, vmInstanceIDs) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go deleted file mode 100644 index ce67ef4c63f4..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go +++ /dev/null @@ -1,4323 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListBySubscription_ByLocation.json -func ExampleVirtualMachineScaleSetsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLocationPager("eastus", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAVmssWithAnExtensionThatHasSuppressFailuresEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - { - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(false), - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]interface{}{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }}, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAVmssWithAnExtensionWithProtectedSettingsFromKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - { - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(false), - ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - }, - }, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]interface{}{}, - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }}, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Name: to.Ptr("osDisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd"), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAPlatformImageScaleSetWithUnmanagedOsDisks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Name: to.Ptr("osDisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - VhdContainers: []*string{ - to.Ptr("http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer"), - to.Ptr("http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer"), - to.Ptr("http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer"), - to.Ptr("http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer"), - to.Ptr("http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer")}, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromACustomImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromAGeneralizedSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromASpecializedSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWhereNicConfigHasDisableTcpStateTrackingProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{nicConfig1-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - DisableTCPStateTracking: to.Ptr(true), - EnableAcceleratedNetworking: to.Ptr(true), - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }, - { - Name: to.Ptr("{nicConfig2-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - DisableTCPStateTracking: to.Ptr(false), - EnableAcceleratedNetworking: to.Ptr(false), - EnableIPForwarding: to.Ptr(false), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{nicConfig2-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name2}"), - }, - }, - }}, - Primary: to.Ptr(false), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithApplicationProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - ApplicationProfile: &armcompute.ApplicationProfile{ - GalleryApplications: []*armcompute.VMGalleryApplication{ - { - ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - EnableAutomaticUpgrade: to.Ptr(false), - Order: to.Ptr[int32](1), - PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - Tags: to.Ptr("myTag1"), - TreatFailureAsDeploymentFailure: to.Ptr(true), - }, - { - PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - }}, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithDiskControllerType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - HardwareProfile: &armcompute.VirtualMachineScaleSetHardwareProfile{ - VMSizeProperties: &armcompute.VMSizeProperties{ - VCPUsAvailable: to.Ptr[int32](1), - VCPUsPerCore: to.Ptr[int32](1), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - DiskControllerType: to.Ptr("NVMe"), - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithDiskEncryptionSetResourceInOsDiskAndDataDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - { - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }}, - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithFpgaNetworkInterfaces() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }, - { - Name: to.Ptr("{fpgaNic-Name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableAcceleratedNetworking: to.Ptr(false), - EnableFpga: to.Ptr(true), - EnableIPForwarding: to.Ptr(false), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{fpgaNic-Name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(false), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - EncryptionAtHost: to.Ptr(true), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSecurityTypeAsConfidentialVm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("2019-datacenter-cvm"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows-cvm"), - Version: to.Ptr("17763.2183.2109130127"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - SecurityProfile: &armcompute.VMDiskSecurityProfile{ - SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DC2as_v5"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithUefiSettingsOfSecureBootAndVTpm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windowsserver-gen2preview-preview"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows10-tvm"), - Version: to.Ptr("18363.592.2001092016"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D2s_v3"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAMarketplaceImagePlan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAnAzureApplicationGateway() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}"), - }}, - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAnAzureLoadBalancer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}"), - }}, - LoadBalancerInboundNatPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}"), - }}, - PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - }, - }, - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAutomaticRepairsEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - Enabled: to.Ptr(true), - GracePeriod: to.Ptr("PT10M"), - }, - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithBootDiagnostics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEmptyDataDisksOnEachVm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiskSizeGB: to.Ptr[int32](512), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D2_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEphemeralOsDisksUsingPlacementProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - Placement: to.Ptr(armcompute.DiffDiskPlacementResourceDisk), - }, - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEphemeralOsDisks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - }, - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithExtensionTimeBudget() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - ExtensionsTimeBudget: to.Ptr("PT1H20M"), - Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - { - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(false), - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]interface{}{}, - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }}, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithManagedBootDiagnostics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPasswordAuthentication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPremiumStorage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPriorityMixPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - OrchestrationMode: to.Ptr(armcompute.OrchestrationModeFlexible), - PriorityMixPolicy: &armcompute.PriorityMixPolicy{ - BaseRegularPriorityCount: to.Ptr[int32](4), - RegularPriorityPercentageAboveBase: to.Ptr[int32](50), - }, - SinglePlacementGroup: to.Ptr(false), - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - BillingProfile: &armcompute.BillingProfile{ - MaxPrice: to.Ptr[float64](-1), - }, - EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesSpot), - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A8m_v2"), - Capacity: to.Ptr[int64](10), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithScaleInPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - ScaleInPolicy: &armcompute.ScaleInPolicy{ - ForceDeletion: to.Ptr(true), - Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)}, - }, - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSpotRestorePolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - Enabled: to.Ptr(true), - RestoreTimeout: to.Ptr("PT1H"), - }, - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - BillingProfile: &armcompute.BillingProfile{ - MaxPrice: to.Ptr[float64](-1), - }, - EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesSpot), - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A8m_v2"), - Capacity: to.Ptr[int64](2), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSshAuthentication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armcompute.SSHConfiguration{ - PublicKeys: []*armcompute.SSHPublicKey{ - { - Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - }}, - }, - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithTerminateScheduledEventsEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT5M"), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithUserData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithVirtualMachinesInDifferentZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("centralus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiskSizeGB: to.Ptr[int32](512), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A1_v2"), - Capacity: to.Ptr[int64](2), - Tier: to.Ptr("Standard"), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("3")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithVmSizeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - HardwareProfile: &armcompute.VirtualMachineScaleSetHardwareProfile{ - VMSizeProperties: &armcompute.VMSizeProperties{ - VCPUsAvailable: to.Ptr[int32](1), - VCPUsPerCore: to.Ptr[int32](1), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createOrUpdateAScaleSetWithCapacityReservation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - CapacityReservation: &armcompute.CapacityReservationProfile{ - CapacityReservationGroup: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetUpdate{ - Tags: map[string]*string{ - "key246": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - }, - Identity: &armcompute.VirtualMachineScaleSetIdentity{ - Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - "key3951": {}, - }, - }, - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - PromotionCode: to.Ptr("aaaaaaaaaa"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetUpdateProperties{ - AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - HibernationEnabled: to.Ptr(true), - UltraSSDEnabled: to.Ptr(true), - }, - AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - Enabled: to.Ptr(true), - GracePeriod: to.Ptr("PT30M"), - }, - DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - Overprovision: to.Ptr(true), - ProximityPlacementGroup: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - ScaleInPolicy: &armcompute.ScaleInPolicy{ - ForceDeletion: to.Ptr(true), - Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)}, - }, - SinglePlacementGroup: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - DisableAutomaticRollback: to.Ptr(true), - EnableAutomaticOSUpgrade: to.Ptr(true), - }, - Mode: to.Ptr(armcompute.UpgradeModeManual), - RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - EnableCrossZoneUpgrade: to.Ptr(true), - MaxBatchInstancePercent: to.Ptr[int32](49), - MaxUnhealthyInstancePercent: to.Ptr[int32](81), - MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - PrioritizeUnhealthyInstances: to.Ptr(true), - }, - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetUpdateVMProfile{ - BillingProfile: &armcompute.BillingProfile{ - MaxPrice: to.Ptr[float64](-1), - }, - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - ExtensionsTimeBudget: to.Ptr("PT1H20M"), - Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - { - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(true), - EnableAutomaticUpgrade: to.Ptr(true), - ForceUpdateTag: to.Ptr("aaaaaaaaa"), - ProtectedSettings: map[string]interface{}{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]interface{}{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }}, - }, - LicenseType: to.Ptr("aaaaaaaaaaaa"), - NetworkProfile: &armcompute.VirtualMachineScaleSetUpdateNetworkProfile{ - HealthProbe: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - }, - NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetUpdateNetworkConfiguration{ - { - ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Name: to.Ptr("aaaaaaaa"), - Properties: &armcompute.VirtualMachineScaleSetUpdateNetworkConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - DNSServers: []*string{}, - }, - EnableAcceleratedNetworking: to.Ptr(true), - EnableFpga: to.Ptr(true), - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetUpdateIPConfiguration{ - { - ID: to.Ptr("aaaaaaaaaaaaaaaa"), - Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Properties: &armcompute.VirtualMachineScaleSetUpdateIPConfigurationProperties{ - ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }}, - ApplicationSecurityGroups: []*armcompute.SubResource{ - { - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }}, - LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }}, - LoadBalancerInboundNatPools: []*armcompute.SubResource{ - { - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }}, - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration{ - Name: to.Ptr("a"), - Properties: &armcompute.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - }, - IdleTimeoutInMinutes: to.Ptr[int32](3), - }, - }, - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - }, - }, - }}, - NetworkSecurityGroup: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetUpdateOSProfile{ - CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - DisablePasswordAuthentication: to.Ptr(true), - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - SSH: &armcompute.SSHConfiguration{ - PublicKeys: []*armcompute.SSHPublicKey{ - { - Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - }}, - }, - }, - Secrets: []*armcompute.VaultSecretGroup{ - { - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - VaultCertificates: []*armcompute.VaultCertificate{ - { - CertificateStore: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - CertificateURL: to.Ptr("aaaaaaa"), - }}, - }}, - WindowsConfiguration: &armcompute.WindowsConfiguration{ - AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - { - ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - PassName: to.Ptr("OobeSystem"), - SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - }}, - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{ - RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), - }, - EnableHotpatching: to.Ptr(true), - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - TimeZone: to.Ptr("aaaaaaaaaaaaaaaa"), - WinRM: &armcompute.WinRMConfiguration{ - Listeners: []*armcompute.WinRMListener{ - { - CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - }}, - }, - }, - }, - ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT10M"), - }, - }, - SecurityProfile: &armcompute.SecurityProfile{ - EncryptionAtHost: to.Ptr(true), - SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetUpdateStorageProfile{ - DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - { - Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - Caching: to.Ptr(armcompute.CachingTypesNone), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskIOPSReadWrite: to.Ptr[int64](28), - DiskMBpsReadWrite: to.Ptr[int64](15), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](26), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("aaaaaaaaaaaa"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - WriteAcceleratorEnabled: to.Ptr(true), - }}, - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SharedGalleryImageID: to.Ptr("aaaaaa"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetUpdateOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - DiskSizeGB: to.Ptr[int32](6), - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"), - }, - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("aaaaaaaaaaaa"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - VhdContainers: []*string{ - to.Ptr("aa")}, - WriteAcceleratorEnabled: to.Ptr(true), - }, - }, - UserData: to.Ptr("aaaaaaaaaaaaa"), - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("DSv3-Type1"), - Capacity: to.Ptr[int64](7), - Tier: to.Ptr("aaa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.json -func ExampleVirtualMachineScaleSetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", &armcompute.VirtualMachineScaleSetsClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json -func ExampleVirtualMachineScaleSetsClient_Get_getVmScaleSetVmWithDiskControllerType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json -func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json -func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json -func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSetWithUserData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetsDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetsDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_DeleteInstances_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetsDeleteInstancesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, &armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions{ForceDeletion: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_DeleteInstances_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetsDeleteInstancesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, &armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions{ForceDeletion: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetInstanceView_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetsGetInstanceViewMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetInstanceView_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetsGetInstanceViewMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetsListAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAllPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetsListAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAllPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetsListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListSKUsPager("rgcompute", "aaaaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetsListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListSKUsPager("rgcompute", "aaaaaaaaaaaaaaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetOSUpgradeHistory_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetsGetOsUpgradeHistoryMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetOSUpgradeHistory_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetsGetOsUpgradeHistoryMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetsPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true), - VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetsPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPowerOff(ctx, "rgcompute", "a", &armcompute.VirtualMachineScaleSetsClientBeginPowerOffOptions{SkipShutdown: nil, - VMInstanceIDs: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetsRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRestartOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetsRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "rgcompute", "aaaa", &armcompute.VirtualMachineScaleSetsClientBeginRestartOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Start_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetsStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginStartOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Start_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetsStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginStartOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetsRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRedeployOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetsRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRedeployOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetsPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetsPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aa", &armcompute.VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_UpdateInstances_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetsUpdateInstancesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_UpdateInstances_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetsUpdateInstancesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Reimage_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetsReimageMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageOptions{VMScaleSetReimageInput: &armcompute.VirtualMachineScaleSetReimageParameters{ - TempDisk: to.Ptr(true), - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Reimage_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetsReimageMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageOptions{VMScaleSetReimageInput: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ReimageAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetsReimageAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageAllOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ReimageAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetsReimageAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageAllOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", 30, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil, - PlacementGroupID: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaa", 9, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil, - PlacementGroupID: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetsConvertToSinglePlacementGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.ConvertToSinglePlacementGroup(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VMScaleSetConvertToSinglePlacementGroupInput{ - ActivePlacementGroupID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetsConvertToSinglePlacementGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.ConvertToSinglePlacementGroup(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VMScaleSetConvertToSinglePlacementGroupInput{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_SetOrchestrationServiceState_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetsSetOrchestrationServiceStateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginSetOrchestrationServiceState(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", armcompute.OrchestrationServiceStateInput{ - Action: to.Ptr(armcompute.OrchestrationServiceStateActionResume), - ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_SetOrchestrationServiceState_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetsSetOrchestrationServiceStateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginSetOrchestrationServiceState(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.OrchestrationServiceStateInput{ - Action: to.Ptr(armcompute.OrchestrationServiceStateActionResume), - ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs), - }, nil) - 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) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go index b73ce99f0905..6c492301a900 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go @@ -58,7 +58,7 @@ func NewVirtualMachineScaleSetVMExtensionsClient(subscriptionID string, credenti // BeginCreateOrUpdate - The operation to create or update the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -80,7 +80,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) BeginCreateOrUpdate(ctx // CreateOrUpdate - The operation to create or update the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) if err != nil { @@ -124,7 +124,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) @@ -132,7 +132,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequ // BeginDelete - The operation to delete the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -153,7 +153,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) BeginDelete(ctx context. // Delete - The operation to delete the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) if err != nil { @@ -197,7 +197,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx // Get - The operation to get the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -258,7 +258,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) getCreateRequest(ctx con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -275,7 +275,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) getHandleResponse(resp * // List - The operation to get all extensions of an instance in Virtual Machine Scaleset. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -323,7 +323,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) listCreateRequest(ctx co if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -340,7 +340,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) listHandleResponse(resp // BeginUpdate - The operation to update the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -362,7 +362,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) BeginUpdate(ctx context. // Update - The operation to update the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) if err != nil { @@ -406,7 +406,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) updateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go deleted file mode 100644 index 6e250abbd1eb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_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. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_Create.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtension{ - Properties: &armcompute.VirtualMachineExtensionProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - Publisher: to.Ptr("extPublisher"), - Settings: map[string]interface{}{ - "UserName": "xyz@microsoft.com", - }, - TypeHandlerVersion: to.Ptr("1.2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_Update.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtensionUpdate{ - Properties: &armcompute.VirtualMachineExtensionUpdateProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - Publisher: to.Ptr("extPublisher"), - Settings: map[string]interface{}{ - "UserName": "xyz@microsoft.com", - }, - TypeHandlerVersion: to.Ptr("1.2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_Delete.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_Get.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", &armcompute.VirtualMachineScaleSetVMExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_List.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMExtensionsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go index dd2fe197879e..844dedca9bc7 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go @@ -58,7 +58,7 @@ func NewVirtualMachineScaleSetVMRunCommandsClient(subscriptionID string, credent // BeginCreateOrUpdate - The operation to create or update the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -80,7 +80,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginCreateOrUpdate(ctx // CreateOrUpdate - The operation to create or update the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) if err != nil { @@ -124,7 +124,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, runCommand) @@ -132,7 +132,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateReq // BeginDelete - The operation to delete the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -153,7 +153,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginDelete(ctx context // Delete - The operation to delete the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) if err != nil { @@ -197,7 +197,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -205,7 +205,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx // Get - The operation to get the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -258,7 +258,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) getCreateRequest(ctx co if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -274,7 +274,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) getHandleResponse(resp } // NewListPager - The operation to get all run commands of an instance in Virtual Machine Scaleset. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -335,7 +335,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) listCreateRequest(ctx c if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -352,7 +352,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) listHandleResponse(resp // BeginUpdate - The operation to update the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -374,7 +374,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginUpdate(ctx context // Update - The operation to update the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) if err != nil { @@ -418,7 +418,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) updateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, runCommand) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go deleted file mode 100644 index a613b62b93e7..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", armcompute.VirtualMachineRunCommand{ - Location: to.Ptr("West US"), - Properties: &armcompute.VirtualMachineRunCommandProperties{ - AsyncExecution: to.Ptr(false), - Parameters: []*armcompute.RunCommandInputParameter{ - { - Name: to.Ptr("param1"), - Value: to.Ptr("value1"), - }, - { - Name: to.Ptr("param2"), - Value: to.Ptr("value2"), - }}, - RunAsPassword: to.Ptr(""), - RunAsUser: to.Ptr("user1"), - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Hello World!"), - }, - TimeoutInSeconds: to.Ptr[int32](3600), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", armcompute.VirtualMachineRunCommandUpdate{ - Properties: &armcompute.VirtualMachineRunCommandProperties{ - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Script Source Updated!"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", &armcompute.VirtualMachineScaleSetVMRunCommandsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMRunCommandsClientListOptions{Expand: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go index bd9330c955bc..c8347c67f5a1 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go @@ -61,7 +61,7 @@ func NewVirtualMachineScaleSetVMsClient(subscriptionID string, credential azcore // the compute resources it uses. You are not billed for the compute resources of this virtual // machine once it is deallocated. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -83,7 +83,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginDeallocate(ctx context.Conte // compute resources it uses. You are not billed for the compute resources of this virtual // machine once it is deallocated. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -123,7 +123,7 @@ func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -131,7 +131,7 @@ func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx conte // BeginDelete - Deletes a virtual machine from a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -151,7 +151,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginDelete(ctx context.Context, // Delete - Deletes a virtual machine from a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -194,7 +194,7 @@ func (client *VirtualMachineScaleSetVMsClient) deleteCreateRequest(ctx context.C if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *VirtualMachineScaleSetVMsClient) deleteCreateRequest(ctx context.C // Get - Gets a virtual machine from a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -250,7 +250,7 @@ func (client *VirtualMachineScaleSetVMsClient) getCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *VirtualMachineScaleSetVMsClient) getHandleResponse(resp *http.Resp // GetInstanceView - Gets the status of a virtual machine from a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -312,7 +312,7 @@ func (client *VirtualMachineScaleSetVMsClient) getInstanceViewCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +328,7 @@ func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleResponse(res } // NewListPager - Gets a list of all virtual machines in a VM scale sets. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // virtualMachineScaleSetName - The name of the VM scale set. // options - VirtualMachineScaleSetVMsClientListOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.List @@ -390,7 +390,7 @@ func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -407,7 +407,7 @@ func (client *VirtualMachineScaleSetVMsClient) listHandleResponse(resp *http.Res // BeginPerformMaintenance - Performs maintenance on a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -427,7 +427,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginPerformMaintenance(ctx conte // PerformMaintenance - Performs maintenance on a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -467,7 +467,7 @@ func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -477,7 +477,7 @@ func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(c // getting charged for the resources. Instead, use deallocate to release resources and avoid // charges. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -499,7 +499,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginPowerOff(ctx context.Context // charged for the resources. Instead, use deallocate to release resources and avoid // charges. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -542,7 +542,7 @@ func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -551,7 +551,7 @@ func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context // BeginRedeploy - Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it // back on. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -572,7 +572,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginRedeploy(ctx context.Context // Redeploy - Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back // on. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -612,7 +612,7 @@ func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -620,7 +620,7 @@ func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context // BeginReimage - Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -640,7 +640,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginReimage(ctx context.Context, // Reimage - Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -680,7 +680,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMScaleSetVMReimageInput != nil { @@ -692,7 +692,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context. // BeginReimageAll - Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation // is only supported for managed disks. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -713,7 +713,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginReimageAll(ctx context.Conte // ReimageAll - Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation // is only supported for managed disks. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageAllOptions) (*http.Response, error) { req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -753,7 +753,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -761,7 +761,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx conte // BeginRestart - Restarts a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -781,7 +781,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginRestart(ctx context.Context, // Restart - Restarts a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -821,7 +821,7 @@ func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -830,7 +830,7 @@ func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context. // RetrieveBootDiagnosticsData - The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM // scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -878,7 +878,7 @@ func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataCreate if options != nil && options.SasURIExpirationTimeInMinutes != nil { reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) } - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -895,7 +895,7 @@ func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataHandle // BeginRunCommand - Run command on a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -918,7 +918,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginRunCommand(ctx context.Conte // RunCommand - Run command on a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) runCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsClientBeginRunCommandOptions) (*http.Response, error) { req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) if err != nil { @@ -958,7 +958,7 @@ func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -966,7 +966,7 @@ func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx conte // SimulateEviction - The operation to simulate the eviction of spot virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -1011,7 +1011,7 @@ func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1019,7 +1019,7 @@ func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx // BeginStart - Starts a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set. // instanceID - The instance ID of the virtual machine. @@ -1039,7 +1039,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginStart(ctx context.Context, r // Start - Starts a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -1079,7 +1079,7 @@ func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1087,7 +1087,7 @@ func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Co // BeginUpdate - Updates a virtual machine of a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // resourceGroupName - The name of the resource group. // vmScaleSetName - The name of the VM scale set where the extension should be create or updated. // instanceID - The instance ID of the virtual machine. @@ -1108,7 +1108,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginUpdate(ctx context.Context, // Update - Updates a virtual machine of a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 func (client *VirtualMachineScaleSetVMsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) if err != nil { @@ -1148,7 +1148,7 @@ func (client *VirtualMachineScaleSetVMsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go deleted file mode 100644 index 4d0f58e10fa6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go +++ /dev/null @@ -1,1040 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "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/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Reimage_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVMsReimageMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: &armcompute.VirtualMachineScaleSetVMReimageParameters{ - TempDisk: to.Ptr(true), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Reimage_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVMsReimageMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimage(ctx, "rgcompute", "aaaaaaa", "aaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_ReimageAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVMsReimageAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_ReimageAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVMsReimageAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVMsDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVMsDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVMsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVM{ - Location: to.Ptr("westus"), - Tags: map[string]*string{}, - Plan: &armcompute.Plan{ - Name: to.Ptr("aaaaaaaaaa"), - Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - }, - Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - HibernationEnabled: to.Ptr(true), - UltraSSDEnabled: to.Ptr(true), - }, - AvailabilitySet: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("aaaaaaaaaaaaa"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesBasicA0), - VMSizeProperties: &armcompute.VMSizeProperties{ - VCPUsAvailable: to.Ptr[int32](9), - VCPUsPerCore: to.Ptr[int32](12), - }, - }, - InstanceView: &armcompute.VirtualMachineScaleSetVMInstanceView{ - BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - Status: &armcompute.InstanceViewStatus{ - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }, - }, - Disks: []*armcompute.DiskInstanceView{ - { - Name: to.Ptr("aaaaaaaaaaa"), - EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - { - DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - SecretURL: to.Ptr("aaaaaaaa"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - Enabled: to.Ptr(true), - KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - }}, - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - }}, - MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - LastOperationMessage: to.Ptr("aaaaaa"), - LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()), - MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()), - PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()), - PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()), - }, - PlacementGroupID: to.Ptr("aaa"), - PlatformFaultDomain: to.Ptr[int32](14), - PlatformUpdateDomain: to.Ptr[int32](23), - RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - { - Type: to.Ptr("aaaaaaaaaaaaa"), - Status: &armcompute.InstanceViewStatus{ - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }, - TypeHandlerVersion: to.Ptr("aaaaa"), - }}, - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - }, - VMHealth: &armcompute.VirtualMachineHealthStatus{ - Status: &armcompute.InstanceViewStatus{ - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }, - }, - Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - { - Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - Type: to.Ptr("aaaaaaaaa"), - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - Substatuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - }}, - }, - LicenseType: to.Ptr("aaaaaaaaaa"), - NetworkProfile: &armcompute.NetworkProfile{ - NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - { - Name: to.Ptr("aaaaaaaaaaa"), - Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - DNSServers: []*string{ - to.Ptr("aaaaaa")}, - }, - DscpConfiguration: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - EnableAcceleratedNetworking: to.Ptr(true), - EnableFpga: to.Ptr(true), - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - { - Name: to.Ptr("aa"), - Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - ApplicationSecurityGroups: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - }, - IdleTimeoutInMinutes: to.Ptr[int32](2), - IPTags: []*armcompute.VirtualMachineIPTag{ - { - IPTagType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - }}, - PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic), - PublicIPPrefix: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - SKU: &armcompute.PublicIPAddressSKU{ - Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - }, - }, - Subnet: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - }}, - NetworkSecurityGroup: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - Primary: to.Ptr(true), - }, - }}, - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - Primary: to.Ptr(true), - }, - }}, - }, - NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - ID: to.Ptr("aaaaaaaa"), - Name: to.Ptr("vmsstestnetconfig5415"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - DNSServers: []*string{}, - }, - EnableAcceleratedNetworking: to.Ptr(true), - EnableFpga: to.Ptr(true), - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - ID: to.Ptr("aaaaaaaaa"), - Name: to.Ptr("vmsstestnetconfig9693"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - ApplicationSecurityGroups: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - LoadBalancerInboundNatPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - }, - IdleTimeoutInMinutes: to.Ptr[int32](18), - IPTags: []*armcompute.VirtualMachineScaleSetIPTag{ - { - IPTagType: to.Ptr("aaaaaaa"), - Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }}, - PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - PublicIPPrefix: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - SKU: &armcompute.PublicIPAddressSKU{ - Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - }, - }, - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - }, - }, - }}, - NetworkSecurityGroup: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("aaaaaaaaaaaaaaaa"), - AdminUsername: to.Ptr("Foo12"), - AllowExtensionOperations: to.Ptr(true), - ComputerName: to.Ptr("test000000"), - CustomData: to.Ptr("aaaa"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - DisablePasswordAuthentication: to.Ptr(true), - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - SSH: &armcompute.SSHConfiguration{ - PublicKeys: []*armcompute.SSHPublicKey{ - { - Path: to.Ptr("aaa"), - KeyData: to.Ptr("aaaaaa"), - }}, - }, - }, - RequireGuestProvisionSignal: to.Ptr(true), - Secrets: []*armcompute.VaultSecretGroup{}, - WindowsConfiguration: &armcompute.WindowsConfiguration{ - AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - { - ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - PassName: to.Ptr("OobeSystem"), - SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - }}, - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - EnableHotpatching: to.Ptr(true), - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - }, - ProvisionVMAgent: to.Ptr(true), - TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - WinRM: &armcompute.WinRMConfiguration{ - Listeners: []*armcompute.WinRMListener{ - { - CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - }}, - }, - }, - }, - ProtectionPolicy: &armcompute.VirtualMachineScaleSetVMProtectionPolicy{ - ProtectFromScaleIn: to.Ptr(true), - ProtectFromScaleSetActions: to.Ptr(true), - }, - SecurityProfile: &armcompute.SecurityProfile{ - EncryptionAtHost: to.Ptr(true), - SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - Caching: to.Ptr(armcompute.CachingTypesNone), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - DiskSizeGB: to.Ptr[int32](128), - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - }, - Lun: to.Ptr[int32](1), - ManagedDisk: &armcompute.ManagedDiskParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("aaaaaaaaaaaa"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - ToBeDetached: to.Ptr(true), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - }, - WriteAcceleratorEnabled: to.Ptr(true), - }}, - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("a"), - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - SKU: to.Ptr("2012-R2-Datacenter"), - Version: to.Ptr("4.127.20180315"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - Caching: to.Ptr(armcompute.CachingTypesNone), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - }, - DiskSizeGB: to.Ptr[int32](127), - EncryptionSettings: &armcompute.DiskEncryptionSettings{ - DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - SecretURL: to.Ptr("aaaaaaaa"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - Enabled: to.Ptr(true), - KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - }, - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - }, - ManagedDisk: &armcompute.ManagedDiskParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("aaaaaaaaaaaa"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - }, - WriteAcceleratorEnabled: to.Ptr(true), - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Classic"), - Capacity: to.Ptr[int64](29), - Tier: to.Ptr("aaaaaaaaaaaaaa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVMsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVM{ - Location: to.Ptr("westus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMsClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json -func ExampleVirtualMachineScaleSetVMsClient_Get_getVmScaleSetVmWithUserData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json -func ExampleVirtualMachineScaleSetVMsClient_Get_getVmScaleSetVmWithVmSizeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json -func ExampleVirtualMachineScaleSetVMsClient_GetInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetInstanceView(ctx, "myResourceGroup", "myVirtualMachineScaleSet", "0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVMsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaa"), - Select: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - Expand: to.Ptr("aaaaaaaaaaaaa"), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVMsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: nil, - Select: nil, - Expand: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVMsPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaa", "aaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVMsPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginPowerOffOptions{SkipShutdown: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVMsRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "rgcompute", "aa", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVMsRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaa", "aaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Start_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVMsStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Start_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVMsStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVMsRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVMsRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.json -func ExampleVirtualMachineScaleSetVMsClient_RetrieveBootDiagnosticsData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVMsPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVMsPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaa", "aaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.json -func ExampleVirtualMachineScaleSetVMsClient_SimulateEviction() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.SimulateEviction(ctx, "ResourceGroup", "VmScaleSetName", "InstanceId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRunCommand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRunCommand(ctx, "myResourceGroup", "myVirtualMachineScaleSet", "0", armcompute.RunCommandInput{ - CommandID: to.Ptr("RunPowerShellScript"), - Script: []*string{ - to.Ptr("Write-Host Hello World!")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go index 2a2e21db635f..219febdec9c2 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go @@ -57,7 +57,7 @@ func NewVirtualMachineSizesClient(subscriptionID string, credential azcore.Token } // NewListPager - This API is deprecated. Use Resources Skus [https://docs.microsoft.com/rest/api/compute/resourceskus/list] -// Generated from API version 2022-08-01 +// Generated from API version 2022-11-01 // location - The location upon which virtual-machine-sizes is queried. // options - VirtualMachineSizesClientListOptions contains the optional parameters for the VirtualMachineSizesClient.List // method. @@ -99,7 +99,7 @@ func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go deleted file mode 100644 index 88da31166bc1..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.json -func ExampleVirtualMachineSizesClient_NewListPager_virtualMachineSizesListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineSizesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("-e", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.json -func ExampleVirtualMachineSizesClient_NewListPager_virtualMachineSizesListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcompute.NewVirtualMachineSizesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("._..", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -}